Skip to content

Commit

Permalink
Merge pull request #205 from Alos/compiler-fixes
Browse files Browse the repository at this point in the history
Made changes to allow compilation with closure compiler
  • Loading branch information
e111077 authored Apr 21, 2017
2 parents 3b751d0 + 73d265c commit cd378c0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 45 deletions.
1 change: 1 addition & 0 deletions firebase-app.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
/**
* The Firebase app object constructed from the other fields of
* this element.
* @type {firebase.app.App}
*/
app: {
type: Object,
Expand Down
5 changes: 5 additions & 0 deletions firebase-common-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
/** @polymerBehavior Polymer.FirebaseCommonBehavior */
Polymer.FirebaseCommonBehaviorImpl = {
properties: {


/**
* @type {!firebase.app.App|undefined}
*/
app: {
type: Object,
notify: true,
Expand Down
9 changes: 7 additions & 2 deletions firebase-database-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@

/**
* Path to a Firebase root or endpoint. N.B. `path` is case sensitive.
* @type {string|null}
*/
path: {
type: String,
observer: '__pathChanged',
value: null
value: null,
observer: '__pathChanged'
},

/**
Expand All @@ -52,6 +53,10 @@
'__onlineChanged(online)'
],

/**
* Set the firebase value.
* @return {!firebase.Promise<void>}
*/
_setFirebaseValue: function(path, value) {
this._log('Setting Firebase value at', path, 'to', value)
var key = value && value.$key;
Expand Down
30 changes: 4 additions & 26 deletions firebase-document.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@
}
},

/**
* @override
*/

get isNew() {
return this.disabled || !this.__pathReady(this.path);
},

/**
* @override
*/

get zeroValue() {
return {};
},
Expand All @@ -73,11 +69,11 @@
* not given, a random key will be generated and used.
* @return {Promise} A promise that resolves once this.data has been
* written to the new path.
* @override
*
*/
saveValue: function(parentPath, key) {
return new Promise(function(resolve, reject) {
var path;
var path = null;

if (!this.app) {
reject(new Error('No app configured!'));
Expand All @@ -102,26 +98,17 @@
}.bind(this));
},

/**
* @override
*/
reset: function() {
this.path = null;
return Promise.resolve();
},

/**
* @override
*/
destroy: function() {
return this._setFirebaseValue(this.path, null).then(function() {
return this.reset();
}.bind(this));
},

/**
* @override
*/
memoryPathToStoragePath: function(path) {
var storagePath = this.path;

Expand All @@ -132,9 +119,6 @@
return storagePath;
},

/**
* @override
*/
storagePathToMemoryPath: function(storagePath) {
var path = 'data';

Expand All @@ -148,9 +132,6 @@
return path;
},

/**
* @override
*/
getStoredValue: function(path) {
return new Promise(function(resolve, reject) {
this.db.ref(path).once('value', function(snapshot) {
Expand All @@ -163,9 +144,6 @@
}.bind(this));
},

/**
* @override
*/
setStoredValue: function(path, value) {
return this._setFirebaseValue(path, value);
},
Expand Down
11 changes: 9 additions & 2 deletions firebase-messaging.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@
(function() {
var stateMap = {};

function applyAll(app, method) {
/**
*
* @param {Object} app
* @param {string} method
* @param {...*} var_args
*/
function applyAll(app, method, var_args) {
var args = Array.prototype.slice.call(arguments, 2);
stateMap[app.name].instances.forEach(function(el) {
el[method].apply(el, args);
Expand Down Expand Up @@ -131,6 +137,7 @@
* The current registration token for this session. Save this
* somewhere server-accessible so that you can target push messages
* to this device.
* @type {String}
*/
token: {
type: String,
Expand Down Expand Up @@ -222,7 +229,7 @@
* must be called after initialization to start listening for push
* messages.
*
* @param {ServiceWorkerRegistration} swreg the custom service worker registration with which to activate
* @param {ServiceWorkerRegistration=} swreg the custom service worker registration with which to activate
*/
activate: function(swreg) {
this.statusKnown = false;
Expand Down
15 changes: 1 addition & 14 deletions firebase-query.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@
return [];
},

/**
* @override
*/
memoryPathToStoragePath: function(path) {
var storagePath = this.path;

Expand All @@ -199,9 +196,6 @@
return storagePath;
},

/**
* @override
*/
storagePathToMemoryPath: function(storagePath) {
var path = 'data';

Expand All @@ -220,9 +214,6 @@
return path;
},

/**
* @override
*/
setStoredValue: function(storagePath, value) {
if (storagePath === this.path || /\$key$/.test(storagePath)) {
return Promise.resolve();
Expand Down Expand Up @@ -276,15 +267,11 @@
return query;
},

/**
* `@override`
*/

__pathChanged: function(path, oldPath) {
// we only need to reset the data if the path is null (will also trigged when this element initiates)
// When path changes and is not null, it triggers a ref change (via __computeRef(db,path)), which then triggers a __queryChanged setting data to zeroValue

if (path == null ) {
if (path == null) {
this.syncToMemory(function() {
this.data = this.zeroValue;
});
Expand Down
2 changes: 1 addition & 1 deletion firebase-storage-script.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script src="../firebase/firebase-storage.js"></script>
<script src="../firebase/firebase-storage.js"></script>

0 comments on commit cd378c0

Please sign in to comment.