Skip to content
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

Add support for synthetic events (CustomEvent) #196

Merged

Conversation

meteficha
Copy link
Contributor

Synthetic events use CustomEvent(), which contains a customizable detail attribute. This PR allows that attribute to be passed to the Haskell side, allowing one to, say, use:

on (domEvent "myEvent") elm $ ...

on the Haskell side, and:

var ev = new CustomEvent("myEvent", { detail: ... });
elm.dispatchEvent(ev);

on the JavaScript side.

Cf. https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent

Synthetic events use CustomEvent(), which contains
a customizable `detail` attribute.  This commit allows
that attribute to be passed to the Haskell side, allowing
one to, say, use:

```haskell
on (domEvent "myEvent") elm $ ...
```

on the Haskell side, and:

```javascript
var ev = new CustomEvent("myEvent", { detail: ... });
elm.dispatchEvent(ev);
```

on the JavaScript side.

Cf. <https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent>
@meteficha meteficha changed the title Add support for synthetic events (CustomEvent). Add support for synthetic events (CustomEvent) Aug 7, 2017
@ndmitchell
Copy link

This seems very useful, anything blocking its review?

@HeinrichApfelmus HeinrichApfelmus merged commit 2dbd7a4 into HeinrichApfelmus:master Aug 19, 2017
@HeinrichApfelmus
Copy link
Owner

HeinrichApfelmus commented Aug 19, 2017

This seems very useful, anything blocking its review?

A lack of leisure time? 😄🖇

I wasn't quite sure how this affects marshalling event data. Apparently, it doesn't, event data is still JSON.

Merged, thanks!

@meteficha
Copy link
Contributor Author

Wicked, thank you!

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.

3 participants