@@ -33,16 +33,16 @@ import { ClientStorage } from 'meteor/ostrio:cstorage';
33
33
Usage:
34
34
========
35
35
#### Get
36
- - ` ClientStorage.get(key) ` - Read a record. If the key doesn't exist a null value will be returned.
36
+ - ` ClientStorage.get(' key' ) ` - Read a record. If the key doesn't exist a null value will be returned.
37
37
38
38
#### Set
39
39
- ` ClientStorage.set('key', value) ` - Create/overwrite a value in storage
40
40
41
41
#### Remove
42
- - ` ClientStorage.remove(key) ` - Remove a record
42
+ - ` ClientStorage.remove(' key' ) ` - Remove a record
43
43
44
44
#### Has
45
- - ` ClientStorage.has(key) ` - Check whether a record exists, returns boolean value
45
+ - ` ClientStorage.has(' key' ) ` - Check whether a record exists, returns boolean value
46
46
47
47
#### Keys
48
48
- ` ClientStorage.keys() ` - Returns an array of all storage keys
@@ -53,16 +53,24 @@ Usage:
53
53
#### Use ` cookies ` only
54
54
To use ` cookies ` as a driver for ` ClientStorage ` create new instance of ` clientStorage ` (* camel-case, first letter __ lower-case__ * )
55
55
``` js
56
+ var clientStorage = require (' ClientStorage' ).clientStorage ;
56
57
var csCookies = new clientStorage (' cookies' );
57
58
```
58
59
60
+ or in ES6 (Meteor):
61
+ ``` jsx
62
+ import { clientStorage } from ' meteor/ostrio:cstorage' ;
63
+ let csLocalStorage = new clientStorage (' cookies' );
64
+ ```
65
+
59
66
#### Use ` localStorage ` only
60
67
To use ` localStorage ` as a driver for ` ClientStorage ` create new instance of ` clientStorage ` (* camel-case, first letter __ lower-case__ * ):
61
68
``` js
62
69
var clientStorage = require (' ClientStorage' ).clientStorage ;
63
70
var csLocalStorage = new clientStorage (' localStorage' );
64
71
```
65
- or in ES6:
72
+
73
+ or in ES6 (Meteor):
66
74
``` jsx
67
75
import { clientStorage } from ' meteor/ostrio:cstorage' ;
68
76
let csLocalStorage = new clientStorage (' localStorage' );
@@ -87,7 +95,7 @@ ClientStorage.has('city'); // false
87
95
ClientStorage .keys (); // ['locale', 'country', 'gender']
88
96
89
97
ClientStorage .remove (' locale' ); // true
90
- ClientStorage .get (' locale' ); // null
98
+ ClientStorage .get (' locale' ); // undefined
91
99
92
100
ClientStorage .keys (); // ['country', 'gender']
93
101
0 commit comments