Using bootstrap.js from the deployment folder in a widget

4
Hi all,   I've just created a widget that makes use of a function in the bootstrap.js. Every Mendix project contains this file by default \deployment\web\lib\bootstrap\js but appearently I can't use functions in my widget. How can I access this file from my widget without adding the bootstrap.js and jQuery.js (since bootstrap.js requires it) to my widget.    Thanks in advance! Jeroen
asked
1 answers
0

Hi Jeroen,

The best practice is to bundle your libs with your widget (it needs to a AMD module).

http://dojotoolkit.org/documentation/tutorials/1.10/modules/

place your lib inside /<WidgetName>/lib

require it in your widget

define([ /* widget module */ "/<WidgetName>/lib/yourModule"], function(/* widget module*/ yourModule){

    // do your module stuff

});

See: https://github.com/mendix/AppStoreWidgetBoilerplate/blob/master/src/WidgetName/widget/WidgetName.js#L37

I would discourage to use JQUERY at all! It does not play well with others and will bite you in your back. 

Cheers, Andries

answered