cookie operations
JS interface operations cookie native browser is very difficult to use.
Js thus producing a handy package.
https://www.npmjs.com/package/js-cookie
A simple, lightweight JavaScript API for handling cookies
- Works in all browsers
- Accepts any character
- Heavily tested
- No dependency
- Unobtrusive JSON support
- Supports AMD/CommonJS
- RFC 6265 compliant
- Useful Wiki
- Enable custom encoding/decoding
- ~900 bytes gzipped!
Basic Usage
Basic Usage
Create a cookie, valid across the entire site:
CookiesCreate a cookie that expires 7 days from now, valid across the entire site:
CookiesCreate an expiring cookie, valid to the path of the current page:
CookiesRead cookie:
CookiesCookiesRead all visible cookies:
Cookies
The client persistence approach
https://www.npmjs.com/package/store2
Local store data to the browser, including local and session storage.
A feature-filled and friendly way to take advantage of localStorage and sessionStorage (JSON, namespacing, extensions, etc).
Download: store2.min.js or store2.js
NPM :npm install store2
NuGet :Install-Package store2
Basic Usage
The main store function can handle
set
,get
,transact
,setAll
,getAll
,each
, andclear
actions directly. Respectively, these are called like so:Parameters in [brackets] are optional. There are also more explicit and versatile functions available:
storestorestorestorestorestorestorestorestorestorestorestorestore
No service mock test
The server need not set up, unlike json-server.
Simplified simulation test method.
Principle, by the method js, ajax server takeover request method json directly from the local data.
Mock.js is a simulation data generator to help the front-end to develop and prototype separate from the back-end progress and reduce some monotony particularly while writing automated tests.
The official site: http://mockjs.com
Features
- Generate simulated data according to the data template
- Provide request/response mocking for ajax requests
Generate simulated data according to HTML-based templatesThis library is loosely inspired by Elijah Manor's post Mocking Introduction, mennovanslooten/mockJSON, appendto/jquery-mockjax and victorquinn/chancejs.