MCPcopy Create free account
hub / github.com/melonjs/melonJS / reload

Function reload

packages/melonjs/src/loader/loader.js:477–501  ·  view source on GitHub ↗
(src)

Source from the content-addressed store, hash-verified

475 * );
476 **/
477export function reload(src) {
478 const assetToReload = failureLoadedAssets[src];
479 unload(assetToReload);
480 resourceCount -= 1;
481
482 new Promise((resolve, reject) => {
483 const count = load(
484 assetToReload,
485 () => {
486 onResourceLoaded(assetToReload);
487 resolve();
488 },
489 (err) => {
490 onLoadingError.call(this, assetToReload);
491 reject(err);
492 },
493 );
494 resourceCount += count;
495 if (count === 0) {
496 resolve();
497 }
498 }).then(() => {
499 completeLoading(onload);
500 });
501}
502
503/**
504 * Load a single asset (to be used if you need to load additional asset(s) during the game)

Callers

nothing calls this directly

Calls 4

onResourceLoadedFunction · 0.85
completeLoadingFunction · 0.85
unloadFunction · 0.70
loadFunction · 0.70

Tested by

no test coverage detected