Commit ce528d16 authored by James Laver's avatar James Laver

Delay stopPropagation and preventDefault in line with Effect

parent 3a3fb2e1
...@@ -5,7 +5,7 @@ import Prelude ...@@ -5,7 +5,7 @@ import Prelude
import DOM.Simple as DOM import DOM.Simple as DOM
import Effect ( Effect ) import Effect ( Effect )
import Effect.Uncurried ( EffectFn1, runEffectFn1 ) import Effect.Uncurried ( EffectFn1, runEffectFn1 )
import FFI.Simple ( (..), (...) ) import FFI.Simple ( (..), (...), delay )
class IsSyntheticEvent e class IsSyntheticEvent e
...@@ -48,10 +48,10 @@ type' e = e .. "type" ...@@ -48,10 +48,10 @@ type' e = e .. "type"
-- nativeEvent e = e .. "nativeEvent" -- nativeEvent e = e .. "nativeEvent"
stopPropagation :: forall e. IsSyntheticEvent e => e -> Effect Unit stopPropagation :: forall e. IsSyntheticEvent e => e -> Effect Unit
stopPropagation e = e ... "stopPropagation" $ [] stopPropagation e = delay $ \_ -> pure $ e ... "stopPropagation" $ []
preventDefault :: forall e. IsSyntheticEvent e => e -> Effect Unit preventDefault :: forall e. IsSyntheticEvent e => e -> Effect Unit
preventDefault e = e ... "preventDefault" $ [] preventDefault e = delay $ \_ -> pure $ e ... "preventDefault" $ []
isPropagationStopped :: forall e. IsSyntheticEvent e => e -> Effect Unit isPropagationStopped :: forall e. IsSyntheticEvent e => e -> Effect Unit
isPropagationStopped e = e ... "isPropagationStopped" $ [] isPropagationStopped e = e ... "isPropagationStopped" $ []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment