From 6ba1ffe74558dd174e3308d48885fb068fa37d55 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 20 Jan 2024 23:13:17 -0500 Subject: WebExtension class (#551) * Add WebExtension class * Use WebExtension class * Use WebExtension instance for all runtime message sending * Use getUrl * Add a sendMessage variant which ignores the response and error --- types/ext/extension.d.ts | 32 -------------------------------- types/ext/web-extension.d.ts | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 32 deletions(-) create mode 100644 types/ext/web-extension.d.ts (limited to 'types') diff --git a/types/ext/extension.d.ts b/types/ext/extension.d.ts index d738936e..dc4657f0 100644 --- a/types/ext/extension.d.ts +++ b/types/ext/extension.d.ts @@ -15,38 +15,6 @@ * along with this program. If not, see . */ -import type * as Core from './core'; - -export type ChromeRuntimeSendMessageArgs1 = [ - message: Core.SafeAny, -]; - -export type ChromeRuntimeSendMessageArgs2 = [ - message: Core.SafeAny, - responseCallback: (response: Core.SafeAny) => void, -]; - -export type ChromeRuntimeSendMessageArgs3 = [ - message: Core.SafeAny, - options: chrome.runtime.MessageOptions, - responseCallback: (response: Core.SafeAny) => void, -]; - -export type ChromeRuntimeSendMessageArgs4 = [ - extensionId: string | undefined | null, - message: Core.SafeAny, - responseCallback: (response: Core.SafeAny) => void, -]; - -export type ChromeRuntimeSendMessageArgs5 = [ - extensionId: string | undefined | null, - message: Core.SafeAny, - options: chrome.runtime.MessageOptions, - responseCallback: (response: Core.SafeAny) => void, -]; - -export type ChromeRuntimeSendMessageArgs = ChromeRuntimeSendMessageArgs1 | ChromeRuntimeSendMessageArgs2 | ChromeRuntimeSendMessageArgs3 | ChromeRuntimeSendMessageArgs4 | ChromeRuntimeSendMessageArgs5; - export type HtmlElementWithContentWindow = HTMLIFrameElement | HTMLFrameElement | HTMLObjectElement; export type ContentOrigin = { diff --git a/types/ext/web-extension.d.ts b/types/ext/web-extension.d.ts new file mode 100644 index 00000000..287e7a72 --- /dev/null +++ b/types/ext/web-extension.d.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2024 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export type Events = { + unloaded: Record; +}; -- cgit v1.2.3