如何在有服务器同步时使 Ember.js 应用离线可用?


使用 ember-localstorage 适配器。

App.store = DS.Store.create({
   revision: 11,
   adapter: DS.LSAdapter.create()
});

示例

你需要定义要用于客户端存储的适配器 −

App.Store = DS.SyncStore.extend({
   revision: 10,
   adapter: DS.IndexedDB.adapter({
      mappings: {
         person: App.Person,
         persons: App.Person,
         contact: App.Contact,
         contacts: App.Contact
      }
   })
});

更新日期:2020 年 6 月 25 日

103 次浏览

开启你的职业生涯

完成课程即可获得认证

开始
广告
© . All rights reserved.