mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
Add types for common browser functions
This commit is contained in:
@@ -39,14 +39,14 @@ export default class NotificationBackground {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserApi.messageListener('notification.background', async (msg: any, sender: any, sendResponse: any) => {
|
BrowserApi.messageListener('notification.background', async (msg: any, sender: chrome.runtime.MessageSender) => {
|
||||||
await this.processMessage(msg, sender, sendResponse);
|
await this.processMessage(msg, sender);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.cleanupNotificationQueue();
|
this.cleanupNotificationQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
async processMessage(msg: any, sender: any, sendResponse: any) {
|
async processMessage(msg: any, sender: chrome.runtime.MessageSender) {
|
||||||
switch (msg.command) {
|
switch (msg.command) {
|
||||||
case 'bgGetDataForTab':
|
case 'bgGetDataForTab':
|
||||||
await this.getDataForTab(sender.tab, msg.responseCommand);
|
await this.getDataForTab(sender.tab, msg.responseCommand);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export default class RuntimeBackground {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.checkOnInstalled();
|
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);
|
await this.processMessage(msg, sender, sendResponse);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ export class BrowserApi {
|
|||||||
chrome.tabs.create({ url: url, active: active });
|
chrome.tabs.create({ url: url, active: active });
|
||||||
}
|
}
|
||||||
|
|
||||||
static messageListener(name: string, callback: (message: any, sender: any, response: any) => void) {
|
static messageListener(name: string, callback: (message: any, sender: chrome.runtime.MessageSender, response: any) => void) {
|
||||||
chrome.runtime.onMessage.addListener((msg: any, sender: any, response: any) => {
|
chrome.runtime.onMessage.addListener((msg: any, sender: chrome.runtime.MessageSender, response: any) => {
|
||||||
callback(msg, sender, response);
|
callback(msg, sender, response);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user