thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.
http://thinkpixellab.com/pxloader
1.11k stars 173 forks source link

Uncaught TypeError: Cannot read property 'origin' of undefined #55

Closed rohan-deshpande closed 8 years ago

rohan-deshpande commented 8 years ago

Simply using PxLoader like this

var loader = new PxLoader(),
    backgroundImg = loader.addImage('assets/art/sprites/sprite-1.png');

loader.start(); 

I am getting this error. When I check the code, I see the options.origin is referenced, but these arguments don't get passed in any of the examples, in my case I wouldn't be passing in options, shouldn't you be checking to see if options is defined before the conditional if (options.origin) ?

Edit well I got around this by passing in all the args, if they are required now, might be a good idea to update the docs. Also, I'm not too sure how the PxAudioLoader is supposed to work... I don't need to play sounds, I just need to load them (I'll be playing them using my own API). When trying to load audio I get an error

Uncaught TypeError: undefined is not a function which is thrown by this line self.audio.load(); (which seems weird to me because if I log the url before that line, it's correct) perhaps I am misunderstanding what the audio loader is meant for?

Edit my bad, was using outdated version of Chromium, all fine now. Still think those args should be in the docs tho.