on(event, callback, cancelCallback) {
    const path = Events.reach.toPath(event)(cache.user);
    if (path) {
      const Cls = Events.reach.toClass(event);
      const cb = (snapData) => {
        const d = Cls ? new Cls(snapData) : null;
        Log.i(`Reach~on(${event})`, d);
        callback(d);
      };
      DataSync.on(path, event, cb, cancelCallback);
      if (!this._callbacks[event]) {
        this._callbacks[event] = [];
      }
      this._callbacks[event].push(cb);
    }
  }
/**
   * Register a callback for a specific event
   * @param {string} event The event name ({@link Events/Reach}). Can be:
   * - USER_ADDED
   * - USER_CHANGED
   * - USER_REMOVED
   * - ROOM_ADDED
   * - ROOM_CHANGED
   * - ROOM_REMOVED
   * - INVITE_ADDED
   * - INVITE_CHANGED
   * @param {function} callback The callback for the event,
   * the arguments depends on the type of event:
   * - USER_*: callback({@link User} u)
   * - ROOM_*: callback({@link Room} r)
   * - INVITE_*: callback({@link Invite} i)
   * @param {Webcom/api.Query~cancelCallback} [cancelCallback] The error callback for the event,
   * takes an Error as only argument
   */
Register a callback for a specific event
@param {string} event The event name ( Events/Reach).
Register a callback for a specific event @param { string } event The event name ( Events / Reach ) .
on(event, callback, cancelCallback) {
    const path = Events.reach.toPath(event)(cache.user);
    if (path) {
      const Cls = Events.reach.toClass(event);
      const cb = (snapData) => {
        const d = Cls ? new Cls(snapData) : null;
        Log.i(`Reach~on(${event})`, d);
        callback(d);
      };
      DataSync.on(path, event, cb, cancelCallback);
      if (!this._callbacks[event]) {
        this._callbacks[event] = [];
      }
      this._callbacks[event].push(cb);
    }
  }
on ( event , callback , cancelCallback ) { const path = Events . reach . toPath ( event ) ( cache . user ) ; if ( path ) { const Cls = Events . reach . toClass ( event ) ; const cb = ( snapData ) => { const d = Cls ? new Cls ( snapData ) : null ; Log . i ( ` ${ event } ` , d ) ; callback ( d ) ; } ; DataSync . on ( path , event , cb , cancelCallback ) ; if ( ! this . _callbacks [ event ] ) { this . _callbacks [ event ] = [ ] ; } this . _callbacks [ event ] . push ( cb ) ; } }
Register a callback for a specific event
 @param {string} event The event name ({@link Events/Reach}).
Register a callback for a specific event @param { string } event The event name ( { @link Events / Reach } ) .