如何在服务器可用时使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
      }
   })
});