firestream

0.1.12 • Public • Published

firestream

var stream = firestream.create(url, { page: 10 });
 
stream
  .map(function(ref) {
    // optional mapping function
    // return mapped value or a Promise with the mapped value
    // @see https://github.com/jogabo/firenext
    return db
      .child('my-objects')
      .child(ref.key())
      .exec();
  })
  .on('value', function(arr) {
    // array of all the values colleced so far
  })
  .on('readable', function() {
    // time to read more data
  })
  .on('end', function() {
    // reached the end
  })
 
// read next 10 children
stream.read();
 
// when new data is added at the top, stream will fire a value event
firebase.child('0').set('zero');
 
// when data is updated, stream will fire a value event
firebase.child('1').set('one..');
 
// when data is moved, stream will fire a value event
firebase.child('1').setPriority(2);
 
// when data is removed, stream will fire a value event
firebase.child('1').remove();
 
 
stream
 

Readme

Keywords

Package Sidebar

Install

npm i firestream

Weekly Downloads

16

Version

0.1.12

License

ISC

Last publish

Collaborators

  • pgherveou2