1.2.6 • Published 1 month ago

@ctrlc/storage v1.2.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 month ago

@ctrlc/storage

网页Storage封装,支持localStoragesessionStoragecookie 、内存四种存储对象,支持nullundefinedbooleanobjectnumberstringdatemapsetobject多种格式。

Usage

import Storage from "@ctrlc/storage";

const storage = new Storage({ 
 namespace: 'app',
 version: '1.0.0'
});

// set
storage.setItem('test', 'test');
storage.setItem('test', 'test', {
 type: 'local', 
 namespace: 'app'
});

storage.setCookie('test', 'test');

// get
storage.getItem('test');
storage.getItem('test', {
 type: 'local', 
 namespace: 'app'
});

storage.getCookie('test');

// remove
storage.removeItem('test');
storage.removeItem('test', {
 type: 'local', 
 namespace: 'app'
});

storage.removeCookie('test');

// clear
storage.clear();
storage.clear({
 type: 'local'
});

storage.clearCookie();

文档

1.2.6

1 month ago

1.2.5

9 months ago

1.2.4

9 months ago

1.2.3

1 year ago

1.2.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago