Skip to content

A library to synchronize Knockout observables, and observableArrays automatically to the localStorage.

Notifications You must be signed in to change notification settings

thvd/knockout.localstorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

knockout.localStorage

##Usage

require(['knockout', 'knockout.localstorage'], function(ko, knockoutLocalStorageObservableFactory) {
  function ViewModel() {
    this.savedObservableInLocalStorage = knockoutLocalStorageObservableFactory.observable('my_key', {
      defaulValue: 'my_value' 
    });
    
    console.log(window.localStorage['my_key']);
    //output: 'my_value';
  }
  
  
  ko.applyBindings(new ViewModel());
});

About

A library to synchronize Knockout observables, and observableArrays automatically to the localStorage.

Resources

Stars

Watchers

Forks

Packages

No packages published