1.0.3 • Published 9 years ago
@cnbritain/merlin-frontend-store-js v1.0.3
merlin-frontend-store-js
Localstorage module that basically uses the Store
JS Documentation
store
store.clear()
Clears all the data
Kind: static method of store
store.forEach(callback)
Loops over each item stored
Kind: static method of store
Param | Type |
---|---|
callback | function |
store.get(key, defaultVal) ⇒ *
Gets the value
Kind: static method of store
Param | Type | Description |
---|---|---|
key | String | |
defaultVal | * | Default value if key is not found |
store.getAll() ⇒ Object
Gets all the data
Kind: static method of store
store.remove(key)
Removes an item from the data
Kind: static method of store
Param | Type |
---|---|
key | String |
store.set(key, val) ⇒ *
Sets a value
Kind: static method of store
Returns: * - The value
Param | Type |
---|---|
key | String |
val | * |
LocalStorage keys
Key | Page | Description |
---|---|---|
search_query | Search | Holds the search query. Used for infinite scroll |
article_referral_uid | Article | Holds the referrer article uid. Used for infinite scroll |
article_exclude_uid | Article | Holds the article uid of the article to exclude. Used for infinite scroll |
article_infinite_scroll | Article | Turns infinite scroll on and off. Used for infinite scroll |
search_query | Search | Holds the search term. Used for infinite scroll |
tag_infinite_url | Tag | Holds the url of the current tag page. Used for infinite scroll |
tag_infinite_scroll | Tag | Turns infinite scroll on and off. Used for infinite scroll |
Prerequisites:
Demo:
Install dependencies:
npm install
Build the things:
npm run sass
npm run js
npm run docs
Hint your JS
npm run jshint
Python the pythons:
npm run demo-install
Start the demo server:
python demo.py