adnbn
Version:
Addon Bone - Cross-browser web extension framework with shared code base
60 lines (57 loc) • 3.2 kB
TypeScript
import { TransportType, TransportDefinition, TransportConfig } from './transport.js';
import { ViewOptions } from './view.js';
import { Awaiter } from './helpers.js';
import 'utility-types';
import '../manifest-DAV18Z2K.js';
import 'react';
import './app.js';
import './browser.js';
import './locale.js';
import './message.js';
import 'html-rspack-tags-plugin';
declare const OffscreenGlobalKey = "adnbnOffscreen";
declare const OffscreenGlobalAccess = "adnbnOffscreenAccess";
declare enum OffscreenReason {
/** A reason used for testing purposes only. */
Testing = "TESTING",
/** The offscreen document is responsible for playing audio. */
AudioPlayback = "AUDIO_PLAYBACK",
/** The offscreen document needs to embed and script an iframe in order to modify the iframe's content. */
IframeScripting = "IFRAME_SCRIPTING",
/** The offscreen document needs to embed an iframe and scrape its DOM to extract information. */
DOMScraping = "DOM_SCRAPING",
/** The offscreen document needs to interact with Blob objects (including URL.createObjectURL()). */
Blobs = "BLOBS",
/** The offscreen document needs to use the DOMParser API. */
DOMParser = "DOM_PARSER",
/** The offscreen document needs to interact with media streams from user media (e.g. getUserMedia()). */
UserMedia = "USER_MEDIA",
/** The offscreen document needs to interact with media streams from display media (e.g. getDisplayMedia()). */
DisplayMedia = "DISPLAY_MEDIA",
/** The offscreen document needs to use WebRTC APIs. */
WebRTC = "WEB_RTC",
/** The offscreen document needs to interact with the clipboard APIs(e.g. Navigator.clipboard). */
Clipboard = "CLIPBOARD",
/** Specifies that the offscreen document needs access to localStorage. */
LocalStorage = "LOCAL_STORAGE",
/** Specifies that the offscreen document needs to spawn workers. */
Workers = "WORKERS",
/** Specifies that the offscreen document needs to use navigator.getBattery. */
BatteryStatus = "BATTERY_STATUS",
/** Specifies that the offscreen document needs to use window.matchMedia. */
MatchMedia = "MATCH_MEDIA",
/** Specifies that the offscreen document needs to use navigator.geolocation. */
Geolocation = "GEOLOCATION"
}
interface OffscreenConfig extends TransportConfig {
reasons?: `${OffscreenReason}` | `${OffscreenReason}`[] | OffscreenReason | OffscreenReason[];
justification?: string;
}
type OffscreenOptions = OffscreenConfig & ViewOptions;
type OffscreenEntrypointOptions = Partial<OffscreenOptions>;
type OffscreenMainHandler<T extends TransportType> = (offscreen: T, options: OffscreenEntrypointOptions) => Awaiter<void>;
interface OffscreenDefinition<T extends TransportType> extends TransportDefinition<OffscreenOptions, T>, OffscreenEntrypointOptions {
main?: OffscreenMainHandler<T>;
}
type OffscreenUnresolvedDefinition<T extends TransportType> = Partial<OffscreenDefinition<T>>;
export { type OffscreenConfig, type OffscreenDefinition, type OffscreenEntrypointOptions, OffscreenGlobalAccess, OffscreenGlobalKey, type OffscreenMainHandler, type OffscreenOptions, OffscreenReason, type OffscreenUnresolvedDefinition };