Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerman committed Nov 10, 2023
1 parent 98ff257 commit 95bc3c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 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

0 comments on commit 95bc3c2

Please sign in to comment.