Skip to content

Commit

Permalink
Update airstream to 16.0.0 (#324)
Browse files Browse the repository at this point in the history
* Update airstream to 16.0.0

* fix

---------

Co-authored-by: johannes karoff <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 10, 2023
1 parent 4121a1c commit 3918ab7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.raquo.airstream.ownership.internalcolibri

import com.raquo.airstream.ownership._
import scala.scalajs.js
import com.raquo.ew.JsArray

object NoopOwner extends Owner {
override protected[this] val subscriptions: js.Array[Subscription] = null
override protected[this] val subscriptions: JsArray[Subscription] = null
override protected[this] def killSubscriptions(): Unit = ()
override protected[this] def onOwned(subscription: Subscription): Unit = ()
override private[ownership] def onKilledExternally(subscription: Subscription): Unit = ()
Expand Down
17 changes: 7 additions & 10 deletions airstream/src/main/scala/colibri/ext/airstream/package.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package colibri.ext

import com.raquo.airstream.core.{Observable, Observer}
import com.raquo.airstream.custom.{CustomSource, CustomStreamSource}
import com.raquo.airstream.core.{Observable, Observer, EventStream}
import com.raquo.airstream.ownership.Subscription
import com.raquo.airstream.ownership.internalcolibri.NoopOwner

Expand Down Expand Up @@ -30,14 +29,12 @@ package object airstream {

implicit object liftSource extends colibri.LiftSource[Observable] {
def lift[H[_]: colibri.Source, A](source: H[A]): Observable[A] = {
val stream = CustomStreamSource[A] { (fireValue, fireError, _, _) =>
var cancelable = colibri.Cancelable.empty
CustomSource.Config(
onStart = () => cancelable = colibri.Source[H].unsafeSubscribe(source)(colibri.Observer.create(fireValue, fireError)),
onStop = () => cancelable.unsafeCancel(),
)
}
stream
var cancelable = colibri.Cancelable.empty
EventStream.fromCustomSource[A](
start = (fireValue, fireError, _, _) =>
cancelable = colibri.Source[H].unsafeSubscribe(source)(colibri.Observer.create(fireValue, fireError)),
stop = _ => cancelable.unsafeCancel(),
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ lazy val airstream = project
.settings(
name := "colibri-airstream",
libraryDependencies ++= Seq(
"com.raquo" %%% "airstream" % "0.14.5",
"com.raquo" %%% "airstream" % "16.0.0",
),
)

Expand Down

0 comments on commit 3918ab7

Please sign in to comment.