1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-13 06:08:06 +09:00
elk/page-lifecycle.d.ts

18 lines
678 B
TypeScript
Raw Normal View History

declare module 'page-lifecycle/dist/lifecycle.mjs' {
2023-02-25 20:09:24 +09:00
type PageLifecycleState = 'active' | 'passive' | 'hidden' | 'frozen' | 'terminated'
interface PageLifecycleEvent extends Event {
newState: PageLifecycleState
oldState: PageLifecycleState
}
interface PageLifecycle extends EventTarget {
get state(): PageLifecycleState
get pageWasDiscarded(): boolean
addUnsavedChanges: (id: Symbol | any) => void
removeUnsavedChanges: (id: Symbol | any) => void
addEventListener: (type: string, listener: (evt: PageLifecycleEvent) => void) => void
}
const lifecycle: PageLifecycle
export default lifecycle
}