Skip to content
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

Added possibility to handle progress during load #143

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

CrazyFlasher
Copy link
Contributor

@CrazyFlasher CrazyFlasher changed the title Added possibility to handle progress during load https://github.com/p… Added possibility to handle progress during load Sep 20, 2023
* @return instance of PIXI resource loader
*/
export function load(scene: AnimateAsset, complete?: Complete): void;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function signature should remain unchanged - your implementation only handles it in a LoadOptions object (which I agree with doing).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if (!loadedAsset)
{
return; // not sure if this can evet happen
return; // not sure if this can event happen
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are fixing typos, the typo here was that it should be even.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

{
if (optionsOrComplete && typeof optionsOrComplete !== 'function')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple suggestions here:

  • Save a local variable like complete up above.
  • Since we already have a callback for each asset, instead of making a new function for each asset to pass to Assets, just do our progress calculation where you are doing loadedAssets++ (which will also ensure that the math is correct).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@andrewstart andrewstart merged commit c586edf into pixijs:master Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants