Skip to content

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

Open
@cuixiping

Description

@cuixiping

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?

.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions