-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Turn dependenciesFulfilled into an array #13220
Conversation
This function returns a promise that resolves when all run dependencies are fulfilled.
This replaces the previous dependenciesFulfilled. Rename to onDependenciesFulfilled
Simply adding to onDependenciesFulfilled would suffice
I've decided for my purposes, it suffices to turn |
This makes it exposable.
What exactly are you trying to achieve? Is there some reason why the current hooks for you:
If you want you code to run after all the file packages have been loaded I think |
What exactly are you trying to achieve?
I load new files after main has run.
|
Then don't you want to put your callback in Doing things during |
I meant that during runtime, users can perform actions to trigger loading new files, and I want to know when those files are loaded.
|
Hmm.. I'm not sure this is the best approach "dependencies fulfilled" means "are the the dependencies of them main application fulfulled and can we now run |
On Sun, Jan 10, 2021 at 04:30:42AM -0800, Sam Clegg wrote:
> I meant that during runtime, users can perform actions to trigger loading new files, and I want to know when those files are loaded.
Hmm.. I'm not sure this is the best approach "dependencies fulfilled" means "are the the dependencies of them main application fulfulled and can we now run `main`." If main is already running then by definition the dependencies are fulfilled. Perhaps its just a questions of renaming / refactoring but the dependencies here are for more than just files, they are for all kind of things. Its sounds like you want some kind of promise that resolves when files are asynchronously loaded at runtime?
That is what I'm looking for, yes. But this is generally difficult to do
without modifying emscripten, possibly significantly, because the files
are loaded as independent script tags. This would also have to wait for
file preloading in case preload plugins are used. The runDependencies
system is an already-in-place system that achieves all these.
|
A downside to generalizing the mechanism as in this PR is that it increases code size. Can you wrap the existing callback? That is, if |
At the moment, this is difficult because it is hard to access dependenciesFulfilled and runDependencies in "external" code.
|
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
This function returns a promise that resolves when all run dependencies are fulfilled. I use this to wait for file_packager bundles to load.
I can add documentation and tests if this feature is accepted.