You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 2, 2020. It is now read-only.
If a requested script cannot be loaded successfully within timeout span, fallback automatically tries to load from the next fallback url (without interrupting the original download). First successful download for each library wins.
Use case for this is a slow responding network, in my case a proxy server which took 60s to return the error code, thus taking my page (with a couple of included scripts and fallback scripts) more than four minutes to load! Now with timeout function it is down to less than 20 seconds.
Currently timeout is set to five seconds. For v2 of fallback this parameter could be made configurable.
me.add_sri_attributes won't always be executed when the page loads. It's possible that this can run based on a User action such as a Click much later after the page has finished loading, in which you a developer may want to lazy load a library. The now variable would need to be defined there in the local scope.
me.add_sri_attributes won't always be executed when the page loads. [...]
Hm, not sure if I understand you... I defined now in method fallback.spawn.instance (not me.add_sri_attributes) which (to my understanding) is the method where loading a library starts, whether this happens during loading the page or at a later time.
I use this now value only to calculate the timeout value which I save a couple of lines further down (in the same method) in variable me.timeouts[library] which I inspect each time my timer gets called.
Should be fine - or have I missed something?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
added timeout function
If a requested script cannot be loaded successfully within timeout span, fallback automatically tries to load from the next fallback url (without interrupting the original download). First successful download for each library wins.
Use case for this is a slow responding network, in my case a proxy server which took 60s to return the error code, thus taking my page (with a couple of included scripts and fallback scripts) more than four minutes to load! Now with timeout function it is down to less than 20 seconds.
Currently timeout is set to five seconds. For v2 of fallback this parameter could be made configurable.