update template

This commit is contained in:
2025-02-02 18:08:09 -06:00
parent f070c12273
commit a04e2bb9d1
575 changed files with 13430 additions and 55 deletions

View File

@@ -0,0 +1,23 @@
package webextension_polyfill.runtime;
/**
An object containing information about the current browser.
**/
typedef BrowserInfo = {
/**
The name of the browser, for example 'Firefox'.
**/
var name : String;
/**
The name of the browser vendor, for example 'Mozilla'.
**/
var vendor : String;
/**
The browser's version, for example '42.0.0' or '0.8.1pre'.
**/
var version : String;
/**
The browser's build ID/date, for example '20160101'.
**/
var buildID : String;
};

View File

@@ -0,0 +1,17 @@
package webextension_polyfill.runtime;
typedef ConnectConnectInfoType = {
/**
Will be passed into onConnect for processes that are listening for the connection event.
Optional.
**/
@:optional
var name : String;
/**
Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection
event.
Optional.
**/
@:optional
var includeTlsChannelId : Bool;
};

View File

@@ -0,0 +1,35 @@
package webextension_polyfill.runtime;
/**
An object containing information about the script context that sent a message or request.
**/
typedef MessageSender = {
/**
The $(ref:tabs.Tab) which opened the connection, if any. This property will <strong>only</strong>
be present when the connection was opened from a tab (including content scripts), and <strong>only</strong>
if the receiver is an extension, not an app.
Optional.
**/
@:optional
var tab : webextension_polyfill.tabs.Tab;
/**
The $(topic:frame_ids)[frame] that opened the connection. 0 for top-level frames, positive for child frames.
This will only be set when <code>tab</code> is set.
Optional.
**/
@:optional
var frameId : Float;
/**
The ID of the extension or app that opened the connection, if any.
Optional.
**/
@:optional
var id : String;
/**
The URL of the page or frame that opened the connection. If the sender is in an iframe,
it will be iframe's URL not the URL of the page which hosts it.
Optional.
**/
@:optional
var url : String;
};

View File

@@ -0,0 +1,19 @@
package webextension_polyfill.runtime;
typedef OnInstalledDetailsType = {
/**
The reason that this event is being dispatched.
**/
var reason : OnInstalledReason;
/**
Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is
'update'.
Optional.
**/
@:optional
var previousVersion : String;
/**
Indicates whether the addon is installed as a temporary extension.
**/
var temporary : Bool;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.runtime;
/**
The reason that this event is being dispatched.
**/
typedef OnInstalledReason = String;

View File

@@ -0,0 +1,8 @@
package webextension_polyfill.runtime;
/**
The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application
is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a
newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.
**/
typedef OnRestartRequiredReason = String;

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.runtime;
/**
The manifest details of the available update.
**/
typedef OnUpdateAvailableDetailsType = {
/**
The version number of the available update.
**/
var version : String;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.runtime;
/**
The machine's processor architecture.
**/
typedef PlatformArch = String;

View File

@@ -0,0 +1,15 @@
package webextension_polyfill.runtime;
/**
An object containing information about the current platform.
**/
typedef PlatformInfo = {
/**
The operating system the browser is running on.
**/
var os : PlatformOs;
/**
The machine's processor architecture.
**/
var arch : PlatformArch;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.runtime;
/**
The operating system the browser is running on.
**/
typedef PlatformOs = String;

View File

@@ -0,0 +1,30 @@
package webextension_polyfill.runtime;
/**
An object which allows two way communication with other pages.
**/
typedef Port = {
var name : String;
function disconnect():Void;
var onDisconnect : webextension_polyfill.events.Event<(port:Port) -> Void>;
var onMessage : webextension_polyfill.events.Event<(message:Dynamic, port:Port) -> Void>;
/**
Send a message to the other end. This takes one argument, which is a JSON object representing the message to send.
It will be delivered to any script listening to the port's onMessage event, or to the native application if this port
is connected to a native application.
**/
function postMessage(message:Dynamic):Void;
/**
This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners.
Optional.
**/
@:optional
var sender : MessageSender;
/**
If the port was disconnected due to an error, this will be set to an object with a string property message,
giving you more information about the error. See onDisconnect.
Optional.
**/
@:optional
var error : PortErrorType;
};

View File

@@ -0,0 +1,9 @@
package webextension_polyfill.runtime;
/**
If the port was disconnected due to an error, this will be set to an object with a string property message,
giving you more information about the error. See onDisconnect.
**/
typedef PortErrorType = {
var message : String;
};

View File

@@ -0,0 +1,13 @@
package webextension_polyfill.runtime;
/**
This will be defined during an API method callback if there was an error
**/
typedef PropertyLastErrorType = {
/**
Details about the error which occurred.
Optional.
**/
@:optional
var message : String;
};

View File

@@ -0,0 +1,11 @@
package webextension_polyfill.runtime;
/**
If an update is available, this contains more information about the available update.
**/
typedef RequestUpdateCheckCallbackDetailsType = {
/**
The version of the available update.
**/
var version : String;
};

View File

@@ -0,0 +1,6 @@
package webextension_polyfill.runtime;
/**
Result of the update check.
**/
typedef RequestUpdateCheckStatus = String;

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.runtime;
typedef SendMessageOptionsType = { };

View File

@@ -0,0 +1,144 @@
package webextension_polyfill.runtime;
typedef Static = {
/**
Retrieves the JavaScript 'window' object for the background page running inside the current extension/app.
If the background page is an event page, the system will ensure it is loaded before calling the callback.
If there is no background page, an error is set.
**/
function getBackgroundPage():js.lib.Promise<js.html.Window>;
/**
<p>Open your Extension's options page, if possible.</p><p>The precise behavior may depend on your manifest's <code>
$(topic:optionsV2)[options_ui]</code> or <code>$(topic:options)[options_page]</code> key,
or what the browser happens to support at the time.</p><p>If your Extension does not declare an options page,
or the browser failed to create one for some other reason, the callback will set $(ref:lastError).</p>
**/
function openOptionsPage():js.lib.Promise<ts.Undefined>;
/**
Returns details about the app or extension from the manifest. The object returned is a serialization of the full
$(topic:manifest)[manifest file].
**/
function getManifest():webextension_polyfill.manifest.WebExtensionManifest;
/**
Converts a relative path within an app/extension install directory to a fully-qualified URL.
**/
function getURL(path:String):String;
/**
Get the frameId of any window global or frame element.
**/
function getFrameId(target:Dynamic):Float;
/**
Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics,
and implement surveys. Maximum 1023 characters.
**/
function setUninstallURL(?url:String):js.lib.Promise<ts.Undefined>;
/**
Reloads the app or extension.
**/
function reload():Void;
/**
Requests an update check for this app/extension.
**/
function requestUpdateCheck():js.lib.Promise<ts.Tuple2<RequestUpdateCheckStatus, RequestUpdateCheckCallbackDetailsType>>;
/**
Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps.
This is useful for content scripts connecting to their extension processes, inter-app/extension communication,
and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a
content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect).
Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps.
This is useful for content scripts connecting to their extension processes, inter-app/extension communication,
and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a
content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect).
**/
@:overload(function(?connectInfo:ConnectConnectInfoType):Port { })
function connect(?extensionId:String, ?connectInfo:ConnectConnectInfoType):Port;
/**
Connects to a native application in the host machine.
**/
function connectNative(application:String):Port;
/**
Sends a single message to event listeners within your extension/app or a different extension/app.
Similar to $(ref:runtime.connect) but only sends a single message, with an optional response.
If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime.
onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this
method. To send messages to content scripts, use $(ref:tabs.sendMessage).
Sends a single message to event listeners within your extension/app or a different extension/app.
Similar to $(ref:runtime.connect) but only sends a single message, with an optional response.
If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime.
onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this
method. To send messages to content scripts, use $(ref:tabs.sendMessage).
**/
@:overload(function(message:Dynamic, ?options:SendMessageOptionsType):js.lib.Promise<Dynamic> { })
function sendMessage(extensionId:Null<String>, message:Dynamic, ?options:SendMessageOptionsType):js.lib.Promise<Dynamic>;
/**
Send a single message to a native application.
**/
function sendNativeMessage(application:String, message:Dynamic):js.lib.Promise<Dynamic>;
/**
Returns information about the current browser.
**/
function getBrowserInfo():js.lib.Promise<BrowserInfo>;
/**
Returns information about the current platform.
**/
function getPlatformInfo():js.lib.Promise<PlatformInfo>;
/**
Fired when a profile that has this extension installed first starts up. This event is not fired for incognito profiles.
**/
var onStartup : webextension_polyfill.events.Event<() -> Void>;
/**
Fired when the extension is first installed, when the extension is updated to a new version,
and when the browser is updated to a new version.
**/
var onInstalled : webextension_polyfill.events.Event<(details:OnInstalledDetailsType) -> Void>;
/**
Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up.
Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed
to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent
and the page won't be unloaded.
**/
var onSuspend : webextension_polyfill.events.Event<() -> Void>;
/**
Sent after onSuspend to indicate that the app won't be unloaded after all.
**/
var onSuspendCanceled : webextension_polyfill.events.Event<() -> Void>;
/**
Fired when an update is available, but isn't installed immediately because the app is currently running.
If you do nothing, the update will be installed the next time the background page gets unloaded,
if you want it to be installed sooner you can explicitly call $(ref:runtime.reload).
If your extension is using a persistent background page, the background page of course never gets unloaded,
so unless you call $(ref:runtime.reload) manually in response to this event the update will not get installed until the
next time the browser itself restarts. If no handlers are listening for this event,
and your extension has a persistent background page, it behaves as if $(ref:runtime.reload)
is called in response to this event.
**/
var onUpdateAvailable : webextension_polyfill.events.Event<(details:OnUpdateAvailableDetailsType) -> Void>;
/**
Fired when a connection is made from either an extension process or a content script.
**/
var onConnect : webextension_polyfill.events.Event<(port:Port) -> Void>;
/**
Fired when a connection is made from another extension.
**/
var onConnectExternal : webextension_polyfill.events.Event<(port:Port) -> Void>;
/**
Fired when a message is sent from either an extension process or a content script.
**/
var onMessage : webextension_polyfill.events.Event<(message:Dynamic, sender:MessageSender, sendResponse:() -> Void) -> ts.AnyOf3<Bool, ts.Undefined, js.lib.Promise<Dynamic>>>;
/**
Fired when a message is sent from another extension/app. Cannot be used in a content script.
**/
var onMessageExternal : webextension_polyfill.events.Event<(message:Dynamic, sender:MessageSender, sendResponse:() -> Void) -> ts.AnyOf3<Bool, ts.Undefined, js.lib.Promise<Dynamic>>>;
/**
This will be defined during an API method callback if there was an error
Optional.
**/
@:optional
var lastError : PropertyLastErrorType;
/**
The ID of the extension/app.
**/
var id : String;
};