Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

handle script load errors #45

Merged
merged 2 commits into from
Nov 7, 2017
Merged

handle script load errors #45

merged 2 commits into from
Nov 7, 2017

Conversation

tomwayson
Copy link
Member

resolves #14

also removeEventListener once the error has been handled
@tomwayson tomwayson merged commit bb706f1 into master Nov 7, 2017
@tomwayson tomwayson deleted the feat/script-onerror branch November 7, 2017 20:03
@davetimmins
Copy link
Contributor

Looks like script.removeEventListener('error', onScriptError, false); should be called when there is no error too i.e. in the script.onload body

@tomwayson
Copy link
Member Author

I think you are right @davetimmins, but am not sure. And here I thought I was going above and beyond by removing a listener for an event that should only ever happen once anyway.

As I mention in #14 (comment), I'm about to push a promise-based branch that uses addEventListener entirely instead of onload and onerror. I'll look into having the 'load' callbacks remove the 'error' callbacks and vice versa, or at the very least ping you on the PR for suggestions.

@tomwayson
Copy link
Member Author

FYI - I didn't add the change (yet) to #48 to "cross remove" the load/error listeners, but it would go hereish. Seems like I'd need to replace those functions w/ a single function that added then removed both listeners, but right now those functions are called by the deprecated functions, so it would be easier once those are removed.

@tomwayson
Copy link
Member Author

FYI - I've addressed this in 2023d6c

I couldn't figure out how to "cross remove" them w/o moving them into a single function, there's a bit of a 🐔 and 🥚 situation, but that will be easier after removing bootstrap() and dojoRequire() and there's no longer any need to keep them as individual functions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle script load errors
2 participants