Playing around with script load firing #5
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.
Doing this as a pull request to see if @lostintangent or @orand have any ideas what I am doing wrong. This pull request does not actually work, but trying to do a different approach in my effort to understand the machinery behind intellisense.
The approach I was trying to do, to allow the autocompletion in define(), was to trigger the load event after each define() call, then explicitly require the module, since by default in requirejs 2.0, define() factory functions are not called unless there is a direct require() for the define().
So I was hoping that in each call to define(), I could do a setTimeout to allow completion of the current script, then look for at the added scripts, find the one that matches a path that was recorded via requirejs.load() and if so, trigger onScriptLoad() for that script.
The trouble seems to be that the setTimeout function tracked by loadTimeId is triggered, but there are no scripts with a script src when it fires.
I guessing there is some magic that intellisense is doing, maybe I'm triggering that loadTimeId setTimeout at the wrong time.