Class: FirebaseAccount

FirebaseAccount

new FirebaseAccount(email, password)

Creates a new reference to a Firebase account.
Parameters:
Name Type Description
email String The email address associated with the account.
password String The password for the account.
Properties:
Name Type Description
ready Promise A promise that will resolve when the account is ready to use and reject if there's a problem logging in.
Source:

Methods

createDatabase(name) → {Promise}

Promises to create a new Firebase instance under the account.
Parameters:
Name Type Description
name String The name of the new instance.
Source:
Returns:
A promise that resolves with a FirebaseInstance if successful and rejects with an Error if there's an error.
Type
Promise
Example
account.createDatabase('newfirebase')
.then(function(db) {
  // get a Firebase reference to the new instance
  var fb = new Firebase(db.toString());
  fb.child('spam/spam/spam/spam').set('wonderful');
})
.catch(function(err) {
  console.error('Error while creating new instance:', err);
});

deleteDatabase(db) → {Promise}

Promises to remove a Firebase instance from the account
Parameters:
Name Type Description
db FirebaseInstance The instance to remove.
Source:
Returns:
A promise that resolves if db is deleted successfully and rejects with an Error if there's an error.
Type
Promise

getDatabase(name) → {Promise}

Promises to retrieve a new Firebase instance under the account.
Parameters:
Name Type Description
name String The name of the instance.
Source:
Returns:
A promise that resolves with a FirebaseInstance if successful and rejects with an Error if there's an error.
Type
Promise
Example
account.getDatabase('existingfirebase')
.then(function(db) {
  // get a Firebase reference to the instance
  var fb = new Firebase(db.toString());
  fb.child('spam/spam/spam/spam').on('value', function(snap) {
    console.log(snap.val(), 'spam, lovely spam');
  });
})
.catch(function(err) {
  console.error('Error retrieving instance:', err);
});