You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As noted in https://github.com/pixijs/pixi.js/pull/2394, it would be nice if the reset functionality of the loader would properly cancel any running tasks. On reset, I would expect the following logic:
If a resource has not started loading, simply remove it from the queue
If a resource has started loading, cancel this process; if there has already been a network request, also call XMLHttpRequest.abort()
If the network request has completed, one should probably still run the corresponding "after"-middlewares (could also be made an option, open for debate)
What would be the use case for this?
Maybe an applications requests a large number of assets, some of which are needed right now and some of which will probably be needed soon. Then, however, the user makes a choice that switches the context of the application and instantly changes the required assets (or at least their priority). In this situation, one would probably want to stop any downloads currently in progress (at least the ones that have not started yet, but possibly all of them) to free up download spots for the assets that are actually needed right now (recall that both the browser and the resource loader have limits on the number of concurrent downloads).
This situation might occur when switching levels in a game or when providing a zoom functionality that uses different assets for different zoom levels (which is the motivation for this request).
Currently, loader.reset() does not cancel xhr requests. In the case of PIXI sprite sheets, this can also lead to a situation where there are _image resources in the resource cache that do not have a corresponding .json resource in the resource cache of the loader.
The text was updated successfully, but these errors were encountered:
As noted in https://github.com/pixijs/pixi.js/pull/2394, it would be nice if the reset functionality of the loader would properly cancel any running tasks. On reset, I would expect the following logic:
What would be the use case for this?
Maybe an applications requests a large number of assets, some of which are needed right now and some of which will probably be needed soon. Then, however, the user makes a choice that switches the context of the application and instantly changes the required assets (or at least their priority). In this situation, one would probably want to stop any downloads currently in progress (at least the ones that have not started yet, but possibly all of them) to free up download spots for the assets that are actually needed right now (recall that both the browser and the resource loader have limits on the number of concurrent downloads).
This situation might occur when switching levels in a game or when providing a zoom functionality that uses different assets for different zoom levels (which is the motivation for this request).
Currently, loader.reset() does not cancel xhr requests. In the case of PIXI sprite sheets, this can also lead to a situation where there are _image resources in the resource cache that do not have a corresponding .json resource in the resource cache of the loader.
The text was updated successfully, but these errors were encountered: