-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
39 lines (31 loc) · 911 Bytes
/
popup.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
console.log('Yes, this file was loaded');
let globalContext;
Front.contextUpdates.subscribe(context => {
globalContext = context;
console.log('Context:', context);
switch(context.type) {
case 'noConversation':
console.log('No conversation selected');
break;
case 'singleConversation':
try {
console.log(context.conversation);
context.listMessages().then((results) => {
console.log('Results: ', results);
});
} catch (error) {
console.log('Error: ', error);
}
break;
case 'multiConversations':
console.log('Multiple conversations selected', context.conversations);
break;
default:
console.error(`Unsupported context type: ${context.type}`);
break;
}
});
async function logContext() {
let messages = await Front.listMessages();
console.log('Fetched messages: ', messages);
}