-
Notifications
You must be signed in to change notification settings - Fork 0
/
UnicronBasicComponent.js
47 lines (33 loc) · 1.42 KB
/
UnicronBasicComponent.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
import { config } from "decepticons/config.js"
class UnicronBasicComponent {
constructor(app) {
//super();
this.app = app;
this._listenToTopic = config.topic_data_change_remote;
this._publishToTopic = config.topic_data_change_local;
//this.id = c.guid();
this.events = this.app.events;
this.session = this.app.session;
this.events.trigger('onComponentStart');
this.topic = 'data.change.local'; // mandatory to be used together UnicronMessagingClient
this.messaging_client = new UnicronMessagingClient(this);
// now this.listener and this.publish are available
this.messaging_client.listener = (message) => {
//console.log("message", message);
console.log("message.detail", message.detail);
//console.log("message.type", message.type);
//console.log("message.timeStamp",message.timeStamp);
console.log('scope of this: UnicronBasicComponent');
};
}
destroy() {
// destroy listener
}
_start() {
// register component listener as a PubSub Listener
}
}
const _root = window || global
( (namespace) => { 'use strict'; })(_root.decepticons = _root.decepticons || {});
( (namespace) => { 'use strict'; })(_root.decepticons.components = _root.decepticons.components || {});
_root.decepticons.components.UnicronBasicComponent = UnicronBasicComponent;