fix: handle frozen page lifecycle state (#1658)
This commit is contained in:
parent
f7a8d471a6
commit
32cfe6371f
10 changed files with 134 additions and 3 deletions
17
page-lifecycle.d.ts
vendored
Normal file
17
page-lifecycle.d.ts
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
declare module 'page-lifecycle/dist/lifecycle.mjs' {
|
||||
type PageLifecycleState = 'pageshow' | 'resume' | 'focus' | 'blur' | 'pagehide' | 'unload' | 'visibilitychange' | 'freeze'
|
||||
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue