-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (47 loc) · 1.48 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(() => {
'use strict';
const logger = global.LoggerFactory.getLogger();
const Messenger = global.helper.Messenger;
const CrudApi = global.helper.CrudApi;
const CrudManager = global.helper.CrudManager;
const BitsToolbarCustomizerManager = require('./bits-toolbar-customizer-manager');
class BitsToolbarCustomizerApp{
/**
* Called when the module is constructed.
*/
constructor() {
this._messenger = new Messenger();
this._manager = new BitsToolbarCustomizerManager();
}
/**
* Called by BITS when the module is loaded.
*
* @param {object} messageCenter - the BITS message center object
*/
load(messageCenter) {
logger.info('Loading Bits Toolbar Customizer!');
this._manager.load(messageCenter);
this._toolbarItemApi = new CrudApi('base#ToolbarItems', messageCenter, {scopes: null});
this._messenger.load(messageCenter)
.then(() => {
console.log('Creating toolbar item');
return this._toolbarItemApi.create({
primary: {
href: '/elements/bits-toolbar-customizer/bits-toolbar-customizer.html',
tag: 'bits-toolbar-customizer'
}
});
})
}
/**
* Called by BITS when the module is unloaded.
*
* @return {any} - the return value is ununsed
*/
unload() {
return Promise.resolve()
.then(() => this._messenger.unload())
}
}
module.exports = new BitsToolbarCustomizerApp();
})();