Use the boilerplate code and change the header to
require({}, [
'dojo/_base/declare', 'mxui/widget/_WidgetBase', 'dijit/_TemplatedMixin',
'mxui/dom', 'dojo/dom', 'dojo/query', 'dojo/dom-prop', 'dojo/dom-geometry', 'dojo/dom-class', 'dojo/dom-style', 'dojo/dom-construct', 'dojo/_base/array', 'dojo/_base/lang', 'dojo/text',
'dojo/text!BooleanSlider/widget/templates/BooleanSlider.html', 'dojox/gesture'
], function (declare, _WidgetBase, _TemplatedMixin, dom, dojoDom, domQuery, domProp, domGeom, domClass, domStyle, domConstruct, dojoArray, lang, text, widgetTemplate, gesture) {
'use strict';
so add the the library to both the library list and to aliases. Use gesture in the widget to invoke.
Does someone have any idea?
Including a dojo module is not different from including any other library. You can just create a folder for the library and in the "define" of widget, include the path to the library correctly. You could take a look at some widget in github as example, many of them use 3rd party lib
I want to comment that dojox/gesture/tap is not included in the mxclientsystem client runtime. You can however include the dojox/gesture/tap to your widget and then include it as such:
require({}, [
'dojo/_base/declare', 'mxui/widget/_WidgetBase', 'dijit/_TemplatedMixin',
'mxui/dom', 'dojo/dom', 'dojo/query', 'dojo/dom-prop', 'dojo/dom-geometry', 'dojo/dom-class', 'dojo/dom-style', 'dojo/dom-construct', 'dojo/_base/array', 'dojo/_base/lang', 'dojo/text',
'dojo/text!BooleanSlider/widget/templates/BooleanSlider.html', 'BooleanSlider/widget/lib/dojox/gesture/tap'
In your AppStoreWidgetBoilerplate you will find a lib folder, place the folder dojox/gesture there and include it with "BooleanSlider/widget/lib/dojox/gesture/tap". Any dependencies to dojox/gesture/tap should also be included that way.
It might be possible that a certain "name" should be available in RequireJS... for instance 'jquery' and the path to where you might find it.
In that case you need to set a package for it.. You configure that like this (jquery as an example):
{
packages: [{ name: 'jquery', location: '../../widgets/WidgetName/lib', main: 'jquery-1.11.2.min' }]
},
If you modify your customwidget.js to require the proper functions you need from that library like:
require(["dojox/gesture/tap"], function(tap){
var widget = {
// your custom widget code
};
mendix.widget.declare('customwidget.widget.customwidget', widget); })
Doesn't this work?