| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 data: { | 57 data: { |
| 58 type: Object, | 58 type: Object, |
| 59 notify: true | 59 notify: true |
| 60 } | 60 } |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 listeners: { | 63 listeners: { |
| 64 'firebase-value': '_onFirebaseValue' | 64 'firebase-value': '_onFirebaseValue' |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 _applyLocalDataChanges: function(change) { | 67 _localDataChanged: function(change) { |
| 68 var pathFragments = change.path.split('.'); | 68 var pathFragments = change.path.split('.'); |
| 69 | 69 |
| 70 if (pathFragments.length === 1) { | 70 if (pathFragments.length === 1) { |
| 71 this._updateRemoteDocument(); | 71 this._updateRemoteDocument(); |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 | 74 |
| 75 this._setRemoteDocumentChild( | 75 this._setRemoteDocumentChild( |
| 76 pathFragments[1], | 76 pathFragments[1], |
| 77 change.base[pathFragments[1]] | 77 change.base[pathFragments[1]] |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 return new Firebase(location); | 92 return new Firebase(location); |
| 93 }, | 93 }, |
| 94 | 94 |
| 95 _updateRemoteDocument: function() { | 95 _updateRemoteDocument: function() { |
| 96 this._log('Updating remote document'); | 96 this._log('Updating remote document'); |
| 97 this.query.update(this.dataAsObject); | 97 this.query.update(this.dataAsObject); |
| 98 }, | 98 }, |
| 99 | 99 |
| 100 _setRemoteDocumentChild: function(key, value) { | 100 _setRemoteDocumentChild: function(key, value) { |
| 101 this._log('Setting child "' + key + '" to', value); | 101 this.debounce('set-' + key, function() { |
| 102 this.query.child(key).set(value); | 102 this._log('Setting child "' + key + '" to', value); |
| 103 this.query.child(key).set(value); |
| 104 }); |
| 103 }, | 105 }, |
| 104 | 106 |
| 105 _removeRemoteDocumentChild: function(key) { | 107 _removeRemoteDocumentChild: function(key) { |
| 106 this._log('Removing child "' + key + '"'); | 108 this._log('Removing child "' + key + '"'); |
| 107 this.query.child(key).remove(); | 109 this.query.child(key).remove(); |
| 108 } | 110 } |
| 109 }); | 111 }); |
| 110 </script> | 112 </script> |
| OLD | NEW |