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

[Feature request] More realistic progress based on bytes for loader and preloader #1188

Open
cuixiping opened this issue Jul 6, 2023 · 0 comments
Labels

Comments

@cuixiping
Copy link

I wish there is a more realistic progress handler based on bytes.

Example code:

let assets = [
     { name : 'image1', src : 'images/image1.png', bytes: 120366 },  // 6.4%
     { name : 'image2', src : 'images/image2.png', bytes: 170214 },  // 9.0%
     { name : 'image3', src : 'images/image3.png', bytes: 192252 },  // 10.2%
     { name : 'binary', src : 'data/binary-data-001', bytes: 1401286 }  // 74.4%
];
let updateProgressDisplay = percent => {
  // do something
};
me.loader.preload(assets,  {
    completed: ()=>this.loaded(),
    progress: (e) => updateProgressDisplay(e.percent)),
});

But it's not a good way if input the bytes numbers manually.

It will be better if some build scripts generate those numbers automatically.

What do you think about it?

.

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

No branches or pull requests

1 participant