Add types for common browser functions
This commit is contained in:
parent
1bf7a7cad6
commit
2699e0f5a0
|
@ -39,14 +39,14 @@ export default class NotificationBackground {
|
|||
return;
|
||||
}
|
||||
|
||||
BrowserApi.messageListener('notification.background', async (msg: any, sender: any, sendResponse: any) => {
|
||||
await this.processMessage(msg, sender, sendResponse);
|
||||
BrowserApi.messageListener('notification.background', async (msg: any, sender: chrome.runtime.MessageSender) => {
|
||||
await this.processMessage(msg, sender);
|
||||
});
|
||||
|
||||
this.cleanupNotificationQueue();
|
||||
}
|
||||
|
||||
async processMessage(msg: any, sender: any, sendResponse: any) {
|
||||
async processMessage(msg: any, sender: chrome.runtime.MessageSender) {
|
||||
switch (msg.command) {
|
||||
case 'bgGetDataForTab':
|
||||
await this.getDataForTab(sender.tab, msg.responseCommand);
|
||||
|
|
|
@ -36,7 +36,7 @@ export default class RuntimeBackground {
|
|||
}
|
||||
|
||||
await this.checkOnInstalled();
|
||||
BrowserApi.messageListener('runtime.background', async (msg: any, sender: any, sendResponse: any) => {
|
||||
BrowserApi.messageListener('runtime.background', async (msg: any, sender: chrome.runtime.MessageSender, sendResponse: any) => {
|
||||
await this.processMessage(msg, sender, sendResponse);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -91,8 +91,8 @@ export class BrowserApi {
|
|||
chrome.tabs.create({ url: url, active: active });
|
||||
}
|
||||
|
||||
static messageListener(name: string, callback: (message: any, sender: any, response: any) => void) {
|
||||
chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => {
|
||||
static messageListener(name: string, callback: (message: any, sender: chrome.runtime.MessageSender, response: any) => void) {
|
||||
chrome.runtime.onMessage.addListener((msg: any, sender: chrome.runtime.MessageSender, response: any) => {
|
||||
callback(msg, sender, response);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue