From 95bc3c235c1835a67752c3b47a3a5391dc49cec0 Mon Sep 17 00:00:00 2001 From: johannes karoff Date: Fri, 10 Nov 2023 14:58:12 +0100 Subject: [PATCH] fix --- .../scala/colibri/ext/airstream/NoopOwner.scala | 4 ++-- .../scala/colibri/ext/airstream/package.scala | 17 +++++++---------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/airstream/src/main/scala/colibri/ext/airstream/NoopOwner.scala b/airstream/src/main/scala/colibri/ext/airstream/NoopOwner.scala index 971cd315..ab4824a1 100644 --- a/airstream/src/main/scala/colibri/ext/airstream/NoopOwner.scala +++ b/airstream/src/main/scala/colibri/ext/airstream/NoopOwner.scala @@ -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 = () diff --git a/airstream/src/main/scala/colibri/ext/airstream/package.scala b/airstream/src/main/scala/colibri/ext/airstream/package.scala index af340e83..3467ef78 100644 --- a/airstream/src/main/scala/colibri/ext/airstream/package.scala +++ b/airstream/src/main/scala/colibri/ext/airstream/package.scala @@ -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 @@ -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(), + ) } }