Skip to content

Add more DOM EventFns #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2018
Merged

Add more DOM EventFns #42

merged 1 commit into from
Jul 3, 2018

Conversation

maddie927
Copy link
Member

@maddie927 maddie927 commented Jul 3, 2018

Minor update

@maddie927 maddie927 self-assigned this Jul 3, 2018

exports.unsafeIsPropagationStopped = function(e) {
return e.isPropagationStopped();
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see comment below)

foreign import unsafePreventDefault :: SyntheticEvent -> SyntheticEvent
preventDefault = unsafeEventFn \e -> unsafePerformEffect do
_ <- (unsafeCoerce e).preventDefault
pure e
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized the FFI file here isn't actually necessary. Is this a bad idea for any reason (other than the unsafeCoerce -- the unsafePerformEffect is safe via EventFn)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(tested this as well -- there was actually a bug with isDefaultPrevented which this fixes)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be safe, yes.

Copy link
Contributor

@paf31 paf31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks great!

@maddie927 maddie927 merged commit db9b860 into master Jul 3, 2018
@maddie927 maddie927 deleted the michael/more-event-fns branch July 3, 2018 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants