Skip to content

Latest commit

 

History

History
70 lines (61 loc) · 1.75 KB

README_Constants.md

File metadata and controls

70 lines (61 loc) · 1.75 KB

Constants

  • Using DeviceEventEmitter

  • Pull Event

DeviceEventEmitter.addListener(CouchBase.PULL ...
  • Push Event
DeviceEventEmitter.addListener(CouchBase.PUSH ...
  • DB Changed Event
DeviceEventEmitter.addListener(CouchBase.DBChanged ...
  • Authentication Error Event
// Use for detecting wrong credentials in remote database
DeviceEventEmitter.addListener(CouchBase.AuthError ...
  • Remote Not Found Error Event
// Use for detecting not existing remote database
DeviceEventEmitter.addListener(CouchBase.NotFound ...
  • Online / Offline Events
// Use for detecting offline status
DeviceEventEmitter.addListener(CouchBase.Online ...
DeviceEventEmitter.addListener(CouchBase.Offline ...
  • Event DB Changed attributes
event.databaseName          (String)    //Database related to event
event.id                    (String)    //ID of the document changed
  • Event PULL/PUSH attributes
event.databaseName          (String)    //Database related to event
event.completedChangesCount (Integer)   //Changes pulled/pushed at the moment
event.changesCount          (Integer)   //Total of changes to pull/push
  • Event AuthError attributes
event.databaseName          (String)    //Database related to event
  • Event NotFound attributes
event.databaseName          (String)    //Database related to event
  • Event Online / Offline attributes
event.databaseName          (String)    //Database related to event
  • Example of use
DeviceEventEmitter.addListener(CouchBase.DBChanged, (event) => {
    if (event.databaseName == 'your database')
        //do something related to document changed event on that database
        console.log(event.id);
    });