Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Added PopStateEvent#133

Merged
garyb merged 2 commits into
purescript-deprecated:masterfrom
coot:popstate-event
Nov 12, 2017
Merged

Added PopStateEvent#133
garyb merged 2 commits into
purescript-deprecated:masterfrom
coot:popstate-event

Conversation

@coot

@coot coot commented Nov 7, 2017

Copy link
Copy Markdown
Contributor

This adds PopStateEvent which is in HTML5 spec.

There is no way of creating events, is this on purpose, or would you accept a PR which adds methods to create events?

@coot

coot commented Nov 7, 2017

Copy link
Copy Markdown
Contributor Author

It would be nice to also include support for PopStateEvent.state property. I think we should reflect state type on the type level with:

foreign import data PopStateEvent :: Type -> Type

Would that be fine?

@garyb

garyb commented Nov 12, 2017

Copy link
Copy Markdown
Member

The missing create event functions are not for any particular reason, they're just missing 😉

I don't think we can do that unfortunately with the state type coming from PopStateEvent, since there's no way we can guarantee that the event is carrying state of the type we expect - we can do that when creating an event, but when it arrives from the DOM we'd just be unsafeCoerceing it pretty much.

@garyb garyb merged commit c7669b6 into purescript-deprecated:master Nov 12, 2017
@coot coot deleted the popstate-event branch November 12, 2017 22:52
@coot

coot commented Nov 12, 2017

Copy link
Copy Markdown
Contributor Author

You're right. At least we can add readState :: forall eff. PopStateEvent -> Eff (dom :: DOM | eff) Foreign.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants