thinkpixellab / PxLoader

PxLoader is a simple JavasScript library for creating preloaders and resource downloaders for HTML5 apps.

Home Page:http://thinkpixellab.com/pxloader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CommonJS support

positlabs opened this issue · comments

The way exports are defined in PxLoader are incompatible with CommonJS. The PxLoader script becomes un-scoped from the window, so exporting to this is useless.

CommonJS support can be added with this line:
if(module && module.exports) module.exports = PxLoader;

Glorious man! Thanks!

As pointed out by @aureliePrd there is an error where "module is not defined". (613791e#commitcomment-14711450)

I think it should use the following syntax

if (typeof module !== 'undefined' && module.exports)

Can you please release a tagged version including CommonJS support. Thanks.