-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update runtime/tabs.sendMessage types to include callback #64
Comments
@mp3por Sorry, I didn't explain clearly. So if you don't need/want to use Promise version of
chrome.runtime.sendMessage({ type: "MessageType" }, undefined, (response) => {
console.log("response", response);
});
// Path: src/global.d.ts
declare namespace chrome {
/// <reference types="chrome-types" />
export namespace runtime {
export function sendMessage(
extensionId: string,
message: any,
callback?: (response: any) => void,
): void;
export function sendMessage(
message: any,
callback?: (response: any) => void,
): void;
}
} UPD: After adjusting types you'll be able to call chrome.runtime.sendMessage({ type: "MessageType" }, (response) => {
console.log("response", response);
}); For simplicity I've only showed example for |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As per documentation of runtime.sendMessage and tabs.sendMessage the methods have a 4th parameter
callback
. At the moment this parameter is missing from the types and typescript complains.The text was updated successfully, but these errors were encountered: