@onebuy/util
v2.0.3
Published
@onebuy/util
Downloads
18
Readme
@onebuy/util
TODO: description
Usage
import { StorageService } from '@onebuy/util';
enum EStorage {
Role = 'role',
User = 'user',
}
const storage = new StorageService<EStorage>({
rootKey: 'onebuy'
});
storage.set(EStorage.Role, 'admin');
storage.get(EStorage.Role); // 'admin'
storage.set(EStorage.User, {
name: 'Lucy',
email: '[email protected]'
});
storage.get(EStorage.User); // { name: 'Lucy', email: '[email protected]' }
storage.remove(EStorage.User);
storage.get(EStorage.User); // undefined
使用UMD
<!-- 需要先导入 axios -->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js" type="text/javascript"></script>
<script src="[email protected]" type="text/javascript"></script>