Skip to content

Instantly share code, notes, and snippets.

@dariooddenino
Last active September 12, 2018 08:55
Show Gist options
  • Save dariooddenino/ec8b3017f48beda5f0fc547836824d17 to your computer and use it in GitHub Desktop.
Save dariooddenino/ec8b3017f48beda5f0fc547836824d17 to your computer and use it in GitHub Desktop.
exports.addCardListenerImpl = function (card, fn) {
card.addEventListener('change', fn);
return null;
}
addCardListener :: Card -> (Event -> Effect Unit) -> Effect Unit
addCardListener = runEffectFn2 addCardListenerImpl
...
eval (Init next) = next <$ do
card <- H.liftEffect mountCard
-- X is logged correctly and it's the stripe response object
H.subscribe $ ES.eventSource (addCardListener card) (Just <<< H.request <<< HandleStripeError <<< spy "X")
eval (HandleStripeError ev reply) = do
-- this is not logged
logShow "HELLO?"
pure $ reply H.Listening
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment