I was wondering if anyone knows how can I reference PreloadJS from a helper module I have created. My RequireJS configuration looks something like this:
require.config({
baseUrl: 'scripts',
paths: {
preloadjs: '../bower_components/PreloadJS/lib/preloadjs-0.6.0.min'
},
shim: {
'preloadjs': {
exports:"createjs.PreloadJS"
}
}
});
And then, what I would like to do is to reference it from my helper module. Something like this:
define([
'jquery',
'underscore',
'preloadjs'
], function ($, _) {
var HelperModule = {
doSomething: function () {
// call preloadjs
},
};
return HelperModule;
});
So I figured out I was having problems with the version of preloadjs I was using. Instead, I went ahead and used 0.4.1.
So this is my setup now:
require.config({
baseUrl: 'scripts',
paths: {
preloadjs: '../bower_components/PreloadJS/lib/preloadjs-0.4.1.min'
},
shim: {
'preloadjs': {
exports:"createjs.LoadQueue"
}
}
});
And then this is how I reference it:
define([
'jquery',
'underscore',
'preloadjs'
], function ($, _, PreloadJS) {
var HelperModule = {
doSomething: function () {
var queue = new PreloadJS();
}
};
return HelperModule;
});