Use Non AMD Javascript Libraries in Durandal 2.0
By using shim, jquery libraries can be used in Durandal.
In the main js, configure shim. I have written a module UIInitialize to intialize the interface. This is dependant on jQuery, jQueryGritter and jQueryPulsate.
The UIInitialize.js is as below:
In the main js, configure shim. I have written a module UIInitialize to intialize the interface. This is dependant on jQuery, jQueryGritter and jQueryPulsate.
requirejs.config({
urlArgs: "bust=" + (new Date()).getTime(),
paths: {
'text': '../Scripts/text',
'durandal': '../Scripts/durandal',
'plugins': '../Scripts/durandal/plugins',
'transitions': '../Scripts/durandal/transitions',
'jQueryGritter': '../Scripts/gritter/js/jquery.gritter',
'jQueryPulsate': '../Scripts/jquery.pulsate.min',
'UIInitialize': '../Scripts/UIGeneral',
},
shim: {
'UIInitialize': {
deps: ['jquery', 'jQueryGritter', 'jQueryPulsate'],
exports: 'UIInitialize'
}
}
});
The UIInitialize.js is as below:
var UIInitialize = function () {
return {
init: function () {
// Initialize gritter and pulsate
}
};
}();
Leave a Comment