-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Proposal for a 2.0 version of this library #842
Comments
/cc @wangela @chrisjshull |
+1 |
The one thing where events are useful is when including the handling of
I see your point, that would be pretty much exactly what @googlemaps/extended-component-library is doing. I'm not too strongly opposed to that but I've had a lot of situations in the past where being able to step-debug through third-party code helped me understand errors and wrong assumptions in my own code. |
Our newer APIs tend to have their own error reporting mechanisms, including auth (instead using the global handler). These days, auth failure in one API doesn’t mean auth failure globally. Let’s discuss fleshing that out instead of tying into gm_authFailure.
Internally, yes. I can look into publishing, but no promises. |
I published a first draft-version of this as draft-PR here: #895 Besides what we talked about here:
|
I think, given the very limited scope of what this library is supposed to do,
it can be significantly simplified for a 2.0 version when effectively rewriting it around the ideas of the dynamic library loading.
The library as it is now seems unnecessarily complicated.
implemented as one. This makes it needlessly complicated to use.
result, where we can just provide one
outdated or not really needed (e.g. functions to remove the API,
which – with newer versions – can't be done completely anyway)
Proposed API
The proposed API exposes just two main parts of functionality: a (static)
method to configure the options and the
importLibrary
function (which isexported independently for convenience).
To get status-information and error messages, the ApiLoader can
implement the
EventTarget
interface (add/removeEventListener):Notes on internal behavior
the ApiLoader doesn't do anything (except for storing the options) until
the
importLibrary
function is called for the first time. This allowsusers to configure the loader in a central place of their application
even if the maps API isn't needed on most pages
Once the importLibrary function is called, the options are frozen and
attempts to modify them will throw an Error (or maybe just log an
error-message to the console?)
the first call to
importLibrary
initiates the bootstrapping, once themaps API is loaded,
importLibrary
will directly forward to thegoogle.maps.importLibrary
function.if an attempt to load the API fails, the loader will resolve all pending
importLibrary
promises with an error and will retry loading with the nextimportLibrary
call.if the library was already loaded by other means than the ApiLoader, a
warning is logged to the console
The text was updated successfully, but these errors were encountered: