-
Notifications
You must be signed in to change notification settings - Fork 14
/
types.ts
35 lines (30 loc) · 971 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
export type RawType = 'String' | 'Number' | 'BigInt' | 'Boolean' | 'Null' | 'Undefined' | 'Object' | 'Array' | 'Set' | 'Map' | 'Date' | 'RegExp' | 'URL' | 'Function'
export interface StorageLike {
[x: string]: any
clear(): void
getItem(key: string): string | null | Promise<string | null>
key(key: number): string | null | Promise<string | null>
setItem(key: string, value: any, options?: StorageOptions): void
removeItem(key: string): void
length: number
}
export type StorageValue = string | number | bigint | boolean | null | undefined | Object
export interface StorageOptions {
expires?: ExpiresType
disposable?: boolean
}
export type EffectMap = Map<string, Effect[]>
export type EffectFn<V = any, OV = any> = (
value?: V,
oldValue?: OV
) => any
export interface Effect {
ctx: any
fn: EffectFn
}
export interface StorageObject {
type: string
value: any
options?: StorageOptions
}
export type ExpiresType = string | number | Date