Skip to content

Commit

Permalink
assorted changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Mar 2, 2024
1 parent 6a8a14d commit ff87a1a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object DeltaStateReactive {
applyDelta: (DState, Delta) => DState,
handlers: Seq[(DynamicTicket[BundleState], DState) => Delta]
)(implicit name: ReInfo, creationTicket: CreationTicket[BundleState]): DeltaStateReactive[Delta, DState] =
creationTicket.create(Set(deltaInput), DeltaWithState(List.empty[Delta], init), needsReevaluation = false)(state =>
creationTicket.scope.create(Set(deltaInput), DeltaWithState(List.empty[Delta], init), needsReevaluation = false)(state =>
new DeltaStateReactive(state, deltaInput, applyDelta, handlers, name)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class ReactorWithoutAPITest extends RETests {
initialValue: T,
dependencies: Set[ReSource.of[State]]
)(stageBuilder: StageBuilder[T])(implicit ct: CreationTicket[State]): Reactor[T] = {
ct.create(
ct.scope.create(
dependencies,
new ReactorStage[T](initialValue, stageBuilder),
needsReevaluation = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,7 @@ final class AdmissionTicket[State[_]](val tx: Transaction[State], declaredWrites

/** Enables the creation of other reactives */
@implicitNotFound(msg = "Could not find capability to create reactives. Maybe a missing import?")
final class CreationTicket[State[_]](val scope: CreationScope[State], val info: ReInfo) {
export scope.{create, createSource}
}
final class CreationTicket[State[_]](val scope: CreationScope[State], val info: ReInfo)

object CreationTicket {
implicit def fromScope[State[_]](implicit scope: CreationScope[State], line: ReInfo): CreationTicket[State] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ object Event {

/** Allows to call some API that requires a callback.
* {{{
* val toggle = Event.fromCallback[UIEvent] {
* val toggle = Event.fromCallback {
* input(`type` := "checkbox",
* onchange := Event.handle)
* onchange := Event.handle[UIEvent])
* }
* }}}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ class WithoutAPITest extends RETests {

val customSource: CustomSource[String] =
implicitly[CreationTicket[State]]
.createSource("Hi!") { createdState =>
.scope.createSource("Hi!") { createdState =>
new CustomSource[String](createdState)
}

assertEquals(transaction(customSource) { _.now(customSource) }, "Hi!")

val customDerived: ReadAs.of[State, String] =
implicitly[CreationTicket[State]]
.create(
.scope.create(
Set(customSource),
"Well, this is an initial value",
needsReevaluation = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package tests.rescala.static.events

import tests.rescala.testtools.RETests

import reactives.default.*

class EventTest extends RETests {
multiEngined { engine =>
import engine._

test("handlers Are Executed") {
var test = 0
Expand Down Expand Up @@ -70,5 +70,4 @@ class EventTest extends RETests {

}

}
}

0 comments on commit ff87a1a

Please sign in to comment.