File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ function shouldResumeField(field: HTMLInputElement | HTMLTextAreaElement): boole
55 return ! ! field . id && field . value !== field . defaultValue && field . form !== submittedForm
66}
77
8- type PersistOptions = { selector ?: string ; keyPrefix ?: string ; storage ?: Storage }
8+ type PersistOptions = {
9+ selector ?: string
10+ keyPrefix ?: string
11+ storage ?: Pick < Storage , 'getItem' | 'setItem' >
12+ }
913
1014// Write all ids and values of the selected fields on the page into sessionStorage.
1115export function persistResumableFields ( id : string , options ?: PersistOptions ) : void {
@@ -42,7 +46,7 @@ export function persistResumableFields(id: string, options?: PersistOptions): vo
4246 }
4347}
4448
45- type RestoreOptions = { keyPrefix ?: string ; storage ?: Storage }
49+ type RestoreOptions = { keyPrefix ?: string ; storage ?: Pick < Storage , 'getItem' | 'setItem' | 'removeItem' > }
4650
4751export function restoreResumableFields ( id : string , options ?: RestoreOptions ) : void {
4852 const keyPrefix = options ?. keyPrefix ?? 'session-resume:'
You can’t perform that action at this time.
0 commit comments