Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions google-client-loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,25 @@
errorEventName: {
type: String,
value: 'google-api-load-error'
},

_clientLoaded: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should both be readOnly: true and use the respective hidden setter to set the values.

type: Boolean,
value: false
},

// Used to fix events potentially being fired multiple times by
// iron-jsonp-library.
_waiting: {
type: Boolean,
value: false
}

},

// Used to fix events potentially being fired multiple times by
// iron-jsonp-library.
_waiting: false,
observers: [
'_tryLoadingApi(_waiting, _clientLoaded, name, version)'
],

/**
* Returns the loaded API.
Expand Down Expand Up @@ -172,6 +185,7 @@

_doneLoadingClient: function() {
_clientLoaded = true;
this._clientLoaded = true;
// Fix for API client load event being fired multiple times by
// iron-jsonp-library.
if (!this._waiting) {
Expand All @@ -188,6 +202,11 @@
return handler;
},

_tryLoadingApi: function(waiting, clientLoaded, name, version) {
if (!waiting && clientLoaded && name && version)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brackets

this._loadApi();
},

_loadApi: function() {
if (_clientLoaded && this.name && this.version) {
this._waiting = false;
Expand Down