Class: FirebaseAdapter

FirebaseAdapter


new FirebaseAdapter(opts)

FirebaseAdapter class.

Method parameters:
Name Type Argument Description
opts Object <optional>

Configuration opts.

Properties
Name Type Argument Default Description
db Object <optional>

See FirebaseAdapter#db

debug Boolean <optional>
false

See Adapter#debug.

raw Boolean <optional>
false

See Adapter#raw.

Details
Source
src/index.js, line 58
Examples

Browser

import {DataStore} from 'js-data'
import firebase from 'firebase'
import {FirebaseAdapter} from 'js-data-firebase'
const store = new DataStore()
firebase.initializeApp({
  apiKey: 'your-api-key',
  databaseURL: 'your-database-url'
})
const adapter = new FirebaseAdapter({ db: firebase.database() })
store.registerAdapter('firebase', adapter, { 'default': true })

Node.js

import {Container} from 'js-data'
import firebase from 'firebase'
import {FirebaseAdapter} from 'js-data-firebase'
const store = new Container()
firebase.initializeApp({
  databaseURL: 'your-database-url',
  serviceAccount: 'path/to/keyfile'
})
const adapter = new FirebaseAdapter({ db: firebase.database() })
store.registerAdapter('firebase', adapter, { 'default': true })

Members


<static> version

Details of the current version of the js-data-firebase module.

Details
Type Source
Object src/index.js, line 540
Properties:
Name Type Description
version.full String

The full semver value.

version.major Number

The major version number.

version.minor Number

The minor version number.

version.patch Number

The patch version number.

version.alpha String | Boolean

The alpha version value, otherwise false if the current version is not alpha.

version.beta String | Boolean

The beta version value, otherwise false if the current version is not beta.


db

The database instance used by this adapter.

Details
Type Default value Source
Object
firebase.database()
src/index.js, line 96

Methods


<static> extend(instanceProps, classProps)

Alternative to ES6 class syntax for extending FirebaseAdapter.

Method parameters:
Name Type Argument Description
instanceProps Object <optional>

Properties that will be added to the prototype of the subclass.

classProps Object <optional>

Properties that will be added as static properties to the subclass itself.

Return value:
Type Description
Constructor

Subclass of FirebaseAdapter.

Details
Source
src/index.js, line 123
Examples

Using the ES2015 class syntax.

class MyFirebaseAdapter extends FirebaseAdapter {...}
const adapter = new MyFirebaseAdapter()

Using FirebaseAdapter.extend.

var instanceProps = {...}
var classProps = {...}

var MyFirebaseAdapter = FirebaseAdapter.extend(instanceProps, classProps)
var adapter = new MyFirebaseAdapter()