1.0.9 • Published 5 years ago

localstorage-util v1.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

localstorage-util

CN

localStorage 的读写操作, 支持版本更新与过期

get操作返回数据类型与set时的数据类型一致

EN

localStorage util, support version upgrade & data expire

get will get the data exactly what set saved

How to use

webpack:

import LocalStorageUtil from 'localstorage-util';

const LS = new LocalStorageUtil({ prefix: 'my_project_' });

LS.set('user', { name: 'Ken' });

const user = LS.get('user');

Browser:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="https://unpkg.com/localstorage-util"></script>
</head>
<body>

<script>
  const myLocalStorage = new LocalStorageUtil({prefix: 'abc'});

  myLocalStorage.set('user', {name: 'zhang', age: 30});

  const user = myLocalStorage.get('user');

  console.log(user);
</script>
</body>
</html>

Contact

Feel free to contact me if you have any questions.

Email: kytogether@vip.qq.com

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago