如何在有伺服器同步可用的情況下讓 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
      }
   })
});

更新於: 25-Jun-2020

102 瀏覽

開啟你的 職業生涯

透過完成課程獲得認證

開始學習
廣告