GoogleWebComponents / google-apis

Web components for loading Google's JavaScript Libraries
https://elements.polymer-project.org/elements/google-apis
Other
87 stars 64 forks source link

[Feature request] Boolean to state if google-client-loader has finished loading #55

Closed mmm111mmm closed 8 years ago

mmm111mmm commented 9 years ago

It currently fires an event.

But there's a case where you may miss the event, but want to check if the client-loader has finished loading its API.

Could we add a public boolean property to state it's been loaded?

Currently it's private:

// Stores whether the API client is done loading.
var _clientLoaded = false;

(My albeit sketchy understanding of javascript promises could help here. Yet there's no promises support in the library, from what I can tell, and putting the onus on the user to wrap something in a promise may be a little burdensome?)

ebidel commented 9 years ago

I think you can check libraryLoaded. That's inherited from iron-jsonp.

mmm111mmm commented 9 years ago

That seems like it'd work, but that property is inherited into google-js-api.

Whereas, google-client-api embeds the google-js-api.

Therefore, any library-loaded property set on google-client-loader won't be passed through the google-js-api, unless I'm missing something.

ebidel commented 8 years ago

You can check the api property. It'll return undefined when the client is not ready.