Skip to content

Commit 92541d7

Browse files
author
Mike Solomon
committed
Updates Event
1 parent ab79706 commit 92541d7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ let additions =
134134
, "now"
135135
]
136136
, repo = "https://github.com/mikesol/purescript-event.git"
137-
, version = "v1.4.1"
137+
, version = "v1.4.2"
138138
}
139139
, typelevel-eval =
140140
{ dependencies =

src/WAGS/Run.purs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ bufferToList timeToCollect incomingEvent =
382382
makeEvent \k -> do
383383
currentTimeoutId <- Ref.new (Nothing :: Maybe TimeoutId)
384384
currentEventList <- Ref.new (Nil :: List { time :: Instant, value :: a })
385-
subscribe timed \a -> do
385+
unsub <- subscribe timed \a -> do
386386
Ref.modify_ (Cons a) currentEventList
387387
inTimeout <- Ref.read currentTimeoutId
388388
when (isNothing inTimeout) $ (flip Ref.write currentTimeoutId <<< Just)
@@ -391,6 +391,8 @@ bufferToList timeToCollect incomingEvent =
391391
Ref.write Nil currentEventList
392392
Ref.write Nothing currentTimeoutId
393393
k cil
394-
pure $ Ref.read currentTimeoutId >>= flip for_ clearTimeout
394+
pure do
395+
Ref.read currentTimeoutId >>= flip for_ clearTimeout
396+
unsub
395397
where
396398
timed = withTime incomingEvent

0 commit comments

Comments
 (0)