How can I implement MVVM with offline storage and Knockout.js?

后端 未结 4 997
旧巷少年郎
旧巷少年郎 2021-02-09 04:22

I can implement Mvvm with Knockout.js. But I want to use it with cross browser(FF and Chrome) supported Html 5 offline storage.

I want to bind html objects to offline

4条回答
  •  礼貌的吻别
    2021-02-09 05:09

    You can use a library such as amplify.js which can serialize objects to localStorage (cross browser). It falls back to older storage tools for older browsers too. First, unwrap the observables to a JSON object, then use amplify.store to serialize the object and store it. Then you can pull it back out and map it back to an observable object when you want to fetch it.

    http://amplifyjs.com/api/store/

提交回复
热议问题