Jump to content

is there a reason to throw Error when reload from loader.add


Recommended Posts



i can look warning from loader when reloading 

this code is pixi.js code into loader.add

// check if resource already exists.    if (this.resources[name]) {        throw new Error('Resource with name "' + name + '" already exists.');    }

i'm wondering why throw Error. 


is there problems if throw callback to complete or return 'this'..?


thx a lot..


Link to comment
Share on other sites

I suspect its just to stop you loading the same asset twice.


If you really do want to reload the asset (e.g. that asset may have changed on the server, although, in this case, versioning would probably be a better solution) you could delete it from `this.resources` and carry on with your reload. You'd have to make sure the original asset isnt being held anywhere else though so that it would be a candidate for garbage collection.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...