-
Notifications
You must be signed in to change notification settings - Fork 14
/
widget.js
23 lines (19 loc) · 875 Bytes
/
widget.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var widget = require('plugins/widget');
// Import the widgets index module, which should export an object
// whose keys are the names of the Widgets to register and the
// values the Widget modules
var widgets = require('widgets/index');
// Widgets usually require a `moduleId` to resolve. We'll override this so
// we return the ViewModel class directly, by looking it up in the `widgets/index`
// file by key.
widget.convertKindToModulePath = function(name) {
var widget = widgets[ name ];
if(!widget) {
console.error('Missing or invalid widget requested: ' + name);
}
return widget;
};
// By default, Durandal will attempt to retrieve the view for a widget using
// the `mapKindToViewId` and pass it along to the `composition` engine. We'll
// do away with this, and force it to use the notmal `getView` method instead.
widget.mapKindToViewId = function() { };