The officially supported adapter for using Firebase with Ember
The officially supported adapter for using Firebase with Ember
This repository is maintained by Googlers but is not a supported Firebase product. Issues here are answered by maintainers and other community members on GitHub on a best-effort basis.
WARNING: Master branch is the work in progress for version 3 of Emberfire. You can find version 2 here, if you're looking for documentation or to contribute to stable. Learn more about the rewrite effort here.
firebase and firebase-app services allow direct access to the underlying Firebase SDK instancerealtime-listener service or the RealtimeRouteMixinAnalyticsRouteMixin adds Google Analytics screen tracking to your Ember Router.FirestoreAdapter$ ember install emberfire@next// app/adapters/application.js
import FirestoreAdapter from 'emberfire/adapters/firestore';
export default FirestoreAdapter.extend({
enablePersistence: true,
persistenceSettings: { synchronizeTabs: true }
});// app/models/article.js
import DS from 'ember-data';
const { attr, belongsTo, hasMany } = DS;
export default DS.Model.extend({
title: attr('string'),
body: attr('string'),
publishedAt: attr('date'),
author: belongsTo('user'),
comments: hasMany('comments', { subcollection: true }),
});// app/routes/articles.js
import Route from '@ember/routing/route';
import RealtimeRouteMixin from 'emberfire/mixins/realtime-route';
import PerformanceRouteMixin from 'emberfire/mixins/performance-route';
export default Route.extend(RealtimeRouteMixin, PerformanceRouteMixin, {
model() {
return this.store.query('article', { orderBy: 'publishedAt' });
}
});// app/routes/application.js
import AnalyticsRouteMixin from 'emberfire/mixins/analytics-route';
import Route from '@ember/routing/route';
export default Route.extend(AnalyticsRouteMixin);Please consult this table when selecting your version of EmberFire and Firebase SDK:
| Ember Data | EmberFire | Firebase SDK |
|---|---|---|
| 3.0+ | 3.x | 5.x |
| 2.3+ | 2.x | 3.x |
| 2.0 - 2.2 | 1.6.x | 2.x |
| 1.13 | 1.5.x | 2.x |
If you'd like to contribute to EmberFire, please first read through our contribution guidelines. Local setup instructions are available here.
No open issues yet, or sync has not completed.