export const ExampleComponent: Component = () => {
const [isLoading, setIsLoading] = createSignal(false);
const handleContextMenuCommand = async (message: string) => {
setIsLoading(true);
await fetch('/example', { body: { message }});
setIsLoading(false);
}
// this line results in a lint error:
chrome.runtime.onMessage.addListener(handleContextMenuCommand);
onCleanup(() => {
chrome.runtime.onMessage.removeListener(handleContextMenuCommand);
});
return <div>Example</div>
};
export const ExampleComponent: Component = () => {
const [isLoading, setIsLoading] = createSignal(false);
const handleContextMenuCommand = async (message: string) => {
setIsLoading(true);
await fetch('/example', { body: { message }});
setIsLoading(false);
}
// this line results in a lint error:
chrome.runtime.onMessage.addListener(handleContextMenuCommand);
onCleanup(() => {
chrome.runtime.onMessage.removeListener(handleContextMenuCommand);
});
return <div>Example</div>
};