lib/rebus.js
function _traverse(props, obj, notification) {
    var length = props.length;
    var refobj = shared;
    var refmeta = meta;
    var handler = {};

    var fns = [];

    for (var i = 0; i < length; i++) {

      var prop = props[i];

      if (!refmeta[prop]) {
        refmeta[prop] = {};
        refmeta[prop][nfs] = {};
      }
      var currentmeta = refmeta[prop];

      if (!refobj[prop]) {
        refobj[prop] = {};
      }
      var currentobj = refobj[prop];

      if (i === (length - 1)) {
        // The end of the path.
        if (obj) {
          // Pin the object here.
          refobj[prop] = obj;
          // Since object changed, append all notifications in the subtree.
          _traverseSubtree(currentmeta, obj, fns);
        }
        if (notification) {
          // Pin notification at the end of the path.
          var id = freeId++;
          currentmeta[nfs][id] = notification;
          // Return value indicates where the notification was pinned.
          handler = { id: id, close: closeNotification };
          handler[nfs] = currentmeta[nfs];
          // Call the notification with initial value of the object.
          // Call notification in the next tick, so that return value from subsribtion
          // will be available.
          process.nextTick(function () {
            notification(currentobj);
          });
        }
      }
      else if (obj) {
        // If change occured, call all notifications along the path.
        _pushNotifications(currentmeta, currentobj, fns);
      }

      // Go deep into the tree.
      refobj = currentobj;
      refmeta = currentmeta;
    }

    if (obj) {
      // Call all notifications.
      async.parallel(fns);
    }

    return handler;
  }
function _traverse(props, obj, notification) {
    var length = props.length;
    var refobj = shared;
    var refmeta = meta;
    var handler = {};

    var fns = [];

    for (var i = 0; i < length; i++) {

      var prop = props[i];

      if (!refmeta[prop]) {
        refmeta[prop] = {};
        refmeta[prop][nfs] = {};
      }
      var currentmeta = refmeta[prop];

      if (!refobj[prop]) {
        refobj[prop] = {};
      }
      var currentobj = refobj[prop];

      if (i === (length - 1)) {
        // The end of the path.
        if (obj) {
          // Pin the object here.
          refobj[prop] = obj;
          // Since object changed, append all notifications in the subtree.
          _traverseSubtree(currentmeta, obj, fns);
        }
        if (notification) {
          // Pin notification at the end of the path.
          var id = freeId++;
          currentmeta[nfs][id] = notification;
          // Return value indicates where the notification was pinned.
          handler = { id: id, close: closeNotification };
          handler[nfs] = currentmeta[nfs];
          // Call the notification with initial value of the object.
          // Call notification in the next tick, so that return value from subsribtion
          // will be available.
          process.nextTick(function () {
            notification(currentobj);
          });
        }
      }
      else if (obj) {
        // If change occured, call all notifications along the path.
        _pushNotifications(currentmeta, currentobj, fns);
      }

      // Go deep into the tree.
      refobj = currentobj;
      refmeta = currentmeta;
    }

    if (obj) {
      // Call all notifications.
      async.parallel(fns);
    }

    return handler;
  }
function _traverse ( props , obj , notification ) { var length = props . length ; var refobj = shared ; var refmeta = meta ; var handler = { } ; var fns = [ ] ; for ( var i = 0 ; i < length ; i ++ ) { var prop = props [ i ] ; if ( ! refmeta [ prop ] ) { refmeta [ prop ] = { } ; refmeta [ prop ] [ nfs ] = { } ; } var currentmeta = refmeta [ prop ] ; if ( ! refobj [ prop ] ) { refobj [ prop ] = { } ; } var currentobj = refobj [ prop ] ; if ( i === ( length - 1 ) ) { // The end of the path.
 if ( obj ) { // Pin the object here.
 refobj [ prop ] = obj ; // Since object changed, append all notifications in the subtree.
 _traverseSubtree ( currentmeta , obj , fns ) ; } if ( notification ) { // Pin notification at the end of the path.
 var id = freeId ++ ; currentmeta [ nfs ] [ id ] = notification ; // Return value indicates where the notification was pinned.
 handler = { id : id , close : closeNotification } ; handler [ nfs ] = currentmeta [ nfs ] ; // Call the notification with initial value of the object.
 // Call notification in the next tick, so that return value from subsribtion
 // will be available.
 process . nextTick ( function ( ) { notification ( currentobj ) ; } ) ; } } else if ( obj ) { // If change occured, call all notifications along the path.
 _pushNotifications ( currentmeta , currentobj , fns ) ; } // Go deep into the tree.
 refobj = currentobj ; refmeta = currentmeta ; } if ( obj ) { // Call all notifications.
 async . parallel ( fns ) ; } return handler ; }
Traverse the shared object according to property path. If object is specified, call all affected notifications. Those are the notifications along the property path and in the subtree at the end of the path. props - the path in the shared object. obj - if defined, pin the object at the end of the specified path. notification - if defined, pin the notification at the end of the specified path. Returns - if called with notification, returns the handler with information where the notification was pinned, so can be unpinned later.
Traverse the shared object according to property path . If object is specified call all affected notifications . Those are the notifications along the property path and in the subtree at the end of the path . props - the path in the shared object . obj - if defined pin the object at the end of the specified path . notification - if defined pin the notification at the end of the specified path . Returns - if called with notification returns the handler with information where the notification was pinned so can be unpinned later .