Permalink
Browse files

AMD module support, closes #18

  • Loading branch information...
1 parent 229cce9 commit 8928f97069037d7e75f379a0fe81c92d576d7613 @joelfillmore joelfillmore committed Feb 14, 2013
Showing with 34 additions and 3 deletions.
  1. +10 −0 PxLoader.js
  2. +8 −1 PxLoaderImage.js
  3. +8 −1 PxLoaderSound.js
  4. +8 −1 PxLoaderVideo.js
View
@@ -369,10 +369,20 @@ function PxLoaderTags(values) {
}
}
+// AMD module support
+if (typeof define === 'function' && define.amd) {
+ define('PxLoader', [], function() {
+ return PxLoader;
+ });
+}
+
// shims to ensure we have newer Array utility methods
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) == '[object Array]';
};
}
+
+
+
View
@@ -99,4 +99,11 @@ PxLoader.prototype.addImage = function(url, tags, priority) {
// return the img element to the caller
return imageLoader.img;
-};
+};
+
+// AMD module support
+if (typeof define === 'function' && define.amd) {
+ define('PxLoaderImage', [], function() {
+ return PxLoaderImage;
+ });
+}
View
@@ -88,4 +88,11 @@ PxLoader.prototype.addSound = function(id, url, tags, priority) {
var soundLoader = new PxLoaderSound(id, url, tags, priority);
this.add(soundLoader);
return soundLoader.sound;
-};
+};
+
+// AMD module support
+if (typeof define === 'function' && define.amd) {
+ define('PxLoaderSound', [], function() {
+ return PxLoaderSound;
+ });
+}
View
@@ -108,4 +108,11 @@ PxLoader.prototype.addVideo = function(url, tags, priority) {
// return the vid element to the caller
return videoLoader.vid;
-};
+};
+
+// AMD module support
+if (typeof define === 'function' && define.amd) {
+ define('PxLoaderVideo', [], function() {
+ return PxLoaderVideo;
+ });
+}

0 comments on commit 8928f97

Please sign in to comment.