mikesol / purescript-deku

A PureScript web UI framework
https://purescript-deku.surge.sh/
Apache License 2.0
123 stars 12 forks source link

Actually remove old event listeners #38

Closed MonoidMusician closed 1 year ago

MonoidMusician commented 1 year ago

eventListener creates a new reference (that's why it's in Effect), distinct from old ones, so we need to store the result of that instead of the callback we passed to it

MonoidMusician commented 1 year ago

Example to reproduce it with:

D.button
  ((D.OnClick := _) <<< (log :: String -> Effect Unit) <$>
    oneOfMap bang ["You should", "only see", "this last one"]
  )
  [ text_ "Useless machine" ]
mikesol commented 1 year ago

Thanks @MonoidMusician !