Example #1
0
  __Synapse.set = function(dotted_path, new_value) {

    var path = dotted_path.split('.').filter(function(part) {
      return (part && true);
    });
    
    var prop = this;
    for (var i=0, ii=path.length; i<ii; i++) {
      if (i == ii-1) {    
        // Last path prop; set to new_value and bail loop
        prop[path[i]] = new_value;
        break;
      }
      else {
        // Dig deeper
        if (prop[path[i]] === undefined) {
          // Pad up path with empty object
          prop[path[i]] = {};
        }    
        prop = prop[path[i]];
      }
    }

    subject.onNext(path);

    return new_value
  };
Example #2
0
 __Synapse.fireOnPath = function(dotted_path) {
   var path = dotted_path.split('.').filter(function(part) {
     return (part && true);
   });
   subject.onNext(path);
 }
Example #3
0
 location.on('value', function(snapshot) {
   subject.onNext(snapshot.val());
 })