mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-10 00:21:27 +01:00
[PM-8518] Adding generic typing to tabSendMessage call
This commit is contained in:
parent
9373c5f9cd
commit
52341fb563
@ -176,16 +176,16 @@ export class BrowserApi {
|
||||
return BrowserApi.tabSendMessage(tab, obj);
|
||||
}
|
||||
|
||||
static async tabSendMessage<T>(
|
||||
static async tabSendMessage<T, TResponse = unknown>(
|
||||
tab: chrome.tabs.Tab,
|
||||
obj: T,
|
||||
options: chrome.tabs.MessageSendOptions = null,
|
||||
): Promise<any> {
|
||||
): Promise<TResponse> {
|
||||
if (!tab || !tab.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
return new Promise<any>((resolve) => {
|
||||
return new Promise<TResponse>((resolve) => {
|
||||
chrome.tabs.sendMessage(tab.id, obj, options, (response) => {
|
||||
if (chrome.runtime.lastError) {
|
||||
// Some error happened
|
||||
|
Loading…
Reference in New Issue
Block a user