Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jimrhoskins/knockout.localStorage
localStorage persistence for knockout.js
https://github.com/jimrhoskins/knockout.localStorage
Last synced: 2 months ago
JSON representation
localStorage persistence for knockout.js
- Host: GitHub
- URL: https://github.com/jimrhoskins/knockout.localStorage
- Owner: jimrhoskins
- License: mit
- Created: 2011-05-16T18:34:39.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-02T16:17:21.000Z (almost 13 years ago)
- Last Synced: 2024-11-02T04:05:48.877Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 67
- Watchers: 5
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-knockout - Local Storage - LocalStorage persistence for Knockout.js (Plugins and libraries)
README
# knockout.localStorage
knockout.localStorage is a plugin for knockout.js which allows observable
values to be saved into localStorage.# Usage
You can make a ko.observable or ko.observableArray automatically persist
its value to localStorage, but adding a second options argument, and
specifying `{ persist: "localStorageKey"}` where `localStorageKey` is
the key to use when storing the value to localHostvar viewModel = {
name: ko.observable(),
nameDefault: ko.observable('Jim'),namePersist: ko.observable(null, {persist: 'namePersist'}),
nameDefaultPersist: ko.observable('James', {persist: 'nameDefaultPersis'})
}
ko.applyBindings(viewModel);