-
Notifications
You must be signed in to change notification settings - Fork 1
/
Application.js
73 lines (55 loc) · 1.37 KB
/
Application.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* @copyright Copyright (c) 2020 Maxim Khorin <maksimovichu@gmail.com>
*/
'use strict';
const Base = require('areto/base/Application');
module.exports = class EvadoApplication extends Base {
getFileStorage () {
return this.components.get('fileStorage');
}
getI18n () {
return this.components.get('i18n');
}
getMailer () {
return this.components.get('mailer');
}
getNotifier () {
return this.components.get('notifier');
}
getObserver () {
return this.components.get('observer');
}
getRbac () {
return this.components.get('rbac');
}
getSession () {
return this.components.get('session');
}
getScheduler () {
return this.components.get('scheduler');
}
emit (event, data) {
return this.getObserver().handle(event, data);
}
// EVENTS
async afterModuleInit () {
await this.loadMeta();
return super.afterModuleInit();
}
// META
getBaseMeta () {
return this.getMeta('base');
}
getMeta (name) {
return this.getMetaHub().get(name);
}
getMetaHub () {
return this.components.get('metaHub');
}
loadMeta () {
const hub = this.getMetaHub();
hub.models.add(this.getConfig('metaModels'));
return hub.load();
}
};
module.exports.init(module);