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

Support all window event handlers #393

Closed
caroso1222 opened this issue Jul 30, 2020 · 0 comments
Closed

Support all window event handlers #393

caroso1222 opened this issue Jul 30, 2020 · 0 comments
Labels
Fixed Fixed in master branch. Pending production release.

Comments

@caroso1222
Copy link
Contributor

Is your feature request related to a problem? Please describe.

This is related to the issue raised in #391. Apart from unbeforeunload and popstate, there are some more window events that should be supported in the element <svelte:window>.

Describe the solution you'd like

I want to be able to use any of the supported window events without typing errors. For example:

<svelte:window on:offline={handler}>
<svelte:window on:pageshow={handler}>
<svelte:window on:beforeprint={handler}>

The full list can be taken from lib.dom.d.ts:

interface WindowEventHandlersEventMap {
    "afterprint": Event;
    "beforeprint": Event;
    "beforeunload": BeforeUnloadEvent;
    "hashchange": HashChangeEvent;
    "languagechange": Event;
    "message": MessageEvent;
    "messageerror": MessageEvent;
    "offline": Event;
    "online": Event;
    "pagehide": PageTransitionEvent;
    "pageshow": PageTransitionEvent;
    "popstate": PopStateEvent;
    "rejectionhandled": PromiseRejectionEvent;
    "storage": StorageEvent;
    "unhandledrejection": PromiseRejectionEvent;
    "unload": Event;
}

Describe alternatives you've considered

I first came around this problem when I was playing with the back button and the history API. I added the methods I needed in #392. Now, I think it makes sense to add support for the full spec instead of just those 2 methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants