UNPKG

3.28 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/store`
3
4# Summary
5This package contains type definitions for store (https://github.com/marcuswestin/store.js#readme).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/store.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/store/index.d.ts)
10````ts
11// Cross-browser storage for all use cases, used across the web.
12
13interface StoreJsAPI {
14 readonly version: string;
15 readonly enabled: boolean;
16 get(key: string, optionalDefaultValue?: any): any;
17 set(key: string, value: any): any;
18 remove(key: string): void;
19 each(callback: (val: any, namespacedKey: string) => void): void;
20 clearAll(): void;
21 hasNamespace(namespace: string): boolean;
22 createStore(plugins?: Function[], namespace?: string): StoreJsAPI;
23 addPlugin(plugin: Function): void;
24 namespace(namespace: string): StoreJsAPI;
25}
26
27interface StoreJsEngine {
28 createStore(storages: any[], plugins?: any[], namespace?: string): StoreJsAPI;
29}
30
31interface StoreJsStorage {
32 name: string;
33 read: (key: string) => string | null;
34 write: (key: string, data: string) => void;
35 each: (callback: (val: string, key: string) => any) => void;
36 remove: (key: string) => void;
37 clearAll: () => void;
38}
39
40declare const store: StoreJsAPI;
41declare module "store" {
42 export = store;
43}
44declare module "store/dist/store.legacy" {
45 export = store;
46}
47declare module "store/dist/store.legacy.min" {
48 export = store;
49}
50declare module "store/dist/store.modern" {
51 export = store;
52}
53declare module "store/dist/store.modern.min" {
54 export = store;
55}
56
57declare const engine: StoreJsEngine;
58declare module "store/src/store-engine" {
59 export = engine;
60}
61declare module "store/plugins/all" {
62 export = Function;
63}
64declare module "store/plugins/defaults" {
65 export = Function;
66}
67declare module "store/plugins/dump" {
68 export = Function;
69}
70declare module "store/plugins/events" {
71 export = Function;
72}
73declare module "store/plugins/expire" {
74 export = Function;
75}
76declare module "store/plugins/observe" {
77 export = Function;
78}
79declare module "store/plugins/operations" {
80 export = Function;
81}
82declare module "store/plugins/update" {
83 export = Function;
84}
85declare module "store/plugins/v1-backcompat" {
86 export = Function;
87}
88
89declare const storage: StoreJsStorage;
90declare module "store/storages/cookieStorage" {
91 export = storage;
92}
93declare module "store/storages/localStorage" {
94 export = storage;
95}
96declare module "store/storages/memoryStorage" {
97 export = storage;
98}
99declare module "store/storages/oldFF-globalStorage" {
100 export = storage;
101}
102declare module "store/storages/oldIE-userDataStorage" {
103 export = storage;
104}
105declare module "store/storages/sessionStorage" {
106 export = storage;
107}
108
109````
110
111### Additional Details
112 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
113 * Dependencies: none
114
115# Credits
116These definitions were written by [Vincent Bortone](https://github.com/vbortone), [harry0000](https://github.com/harry0000), [Roman Nuritdinov (Ky6uk)](https://github.com/Ky6uk), [Johnny Edwards (igl00)](https://github.com/igl00), and [Jason Kwok (JasonHK)](https://github.com/JasonHK).
117
\No newline at end of file