Skip to content

Commit

Permalink
Removed the event customisation for Signal (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdp authored May 20, 2020
1 parent b1cb138 commit 59a1c2b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Wire/Signal.purs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@ create init = do

modify' f = Ref.modify f value >>= inner.push

event' =
Event.makeEvent \emit -> do
Ref.read value >>= emit
Event.subscribe inner.event emit

signal = Signal { event: event', read: read', write: write', modify: modify' }
signal = Signal { event: inner.event, read: read', write: write', modify: modify' }
pure { signal, cancel: inner.cancel }

subscribe :: forall a. Signal a -> Subscriber a -> Effect Canceler
subscribe (Signal s) = Event.subscribe s.event
subscribe (Signal s) k = do
s.read >>= k
Event.subscribe s.event k

event :: forall a. Signal a -> Event a
event (Signal s) = s.event
Expand Down

0 comments on commit 59a1c2b

Please sign in to comment.