如何在有伺服器同步時使 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.