-
Notifications
You must be signed in to change notification settings - Fork 14
/
channelService.js
40 lines (34 loc) · 1.03 KB
/
channelService.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
class AppChannelService {
async joinChannel() {
return await window.fdc3.getOrCreateChannel("test-channel");
}
async broadcast(contextType, historyItem, channel) {
await channel.broadcast({
"type": contextType,
"name": `History-item-${historyItem}`
});
}
async addContextListener(contextType, channel) {
await channel.addContextListener(
contextType,
() => closeFinsembleWindow());
}
}
class UserChannelService {
async joinChannel() {
const channels = await window.fdc3.getSystemChannels();
await window.fdc3.joinChannel(channels[0].id);
return channels[0];
}
async broadcast(contextType, historyItem) {
await window.fdc3.broadcast({
"type": contextType,
"name": `History-item-${historyItem}`
});
}
async addContextListener(contextType) {
await window.fdc3.addContextListener(
contextType,
() => closeFinsembleWindow());
}
}