add firefox extension template

This commit is contained in:
2025-08-07 16:03:16 -05:00
parent 6cbb29fed1
commit 5df289ffcb
586 changed files with 13636 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
package webextension_polyfill.notifications;
typedef CreateNotificationOptions = {
/**
Which type of notification to display.
**/
var type : TemplateType;
/**
A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
Optional.
**/
@:optional
var iconUrl : String;
/**
A URL to the app icon mask.
Optional.
**/
@:optional
var appIconMaskUrl : String;
/**
Title of the notification (e.g. sender name for email).
**/
var title : String;
/**
Main notification content.
**/
var message : String;
/**
Alternate notification content with a lower-weight font.
Optional.
**/
@:optional
var contextMessage : String;
/**
Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.
Optional.
**/
@:optional
var priority : Float;
/**
A timestamp associated with the notification, in milliseconds past the epoch.
Optional.
**/
@:optional
var eventTime : Float;
/**
A URL to the image thumbnail for image-type notifications.
Optional.
**/
@:optional
var imageUrl : String;
/**
Items for multi-item notifications.
Optional.
**/
@:optional
var items : Array<NotificationItem>;
/**
Current progress ranges from 0 to 100.
Optional.
**/
@:optional
var progress : Float;
/**
Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
Optional.
**/
@:optional
var isClickable : Bool;
};

View File

@@ -0,0 +1,12 @@
package webextension_polyfill.notifications;
typedef NotificationItem = {
/**
Title of one item of a list notification.
**/
var title : String;
/**
Additional details about this item.
**/
var message : String;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.notifications;
typedef PermissionLevel = String;

View File

@@ -0,0 +1,35 @@
package webextension_polyfill.notifications;
typedef Static = {
/**
Creates and displays a notification.
Creates and displays a notification.
**/
@:overload(function(options:CreateNotificationOptions):js.lib.Promise<String> { })
function create(notificationId:Null<String>, options:CreateNotificationOptions):js.lib.Promise<String>;
/**
Clears an existing notification.
**/
function clear(notificationId:String):js.lib.Promise<Bool>;
/**
Retrieves all the notifications.
**/
function getAll():js.lib.Promise<haxe.DynamicAccess<CreateNotificationOptions>>;
/**
Fired when the notification closed, either by the system or by user action.
**/
var onClosed : webextension_polyfill.events.Event<(notificationId:String, byUser:Bool) -> Void>;
/**
Fired when the user clicked in a non-button area of the notification.
**/
var onClicked : webextension_polyfill.events.Event<(notificationId:String) -> Void>;
/**
Fired when the user pressed a button in the notification.
**/
var onButtonClicked : webextension_polyfill.events.Event<(notificationId:String, buttonIndex:Float) -> Void>;
/**
Fired when the notification is shown.
**/
var onShown : webextension_polyfill.events.Event<(notificationId:String) -> Void>;
};

View File

@@ -0,0 +1,3 @@
package webextension_polyfill.notifications;
typedef TemplateType = String;

View File

@@ -0,0 +1,76 @@
package webextension_polyfill.notifications;
typedef UpdateNotificationOptions = {
/**
Which type of notification to display.
Optional.
**/
@:optional
var type : TemplateType;
/**
A URL to the sender's avatar, app icon, or a thumbnail for image notifications.
Optional.
**/
@:optional
var iconUrl : String;
/**
A URL to the app icon mask.
Optional.
**/
@:optional
var appIconMaskUrl : String;
/**
Title of the notification (e.g. sender name for email).
Optional.
**/
@:optional
var title : String;
/**
Main notification content.
Optional.
**/
@:optional
var message : String;
/**
Alternate notification content with a lower-weight font.
Optional.
**/
@:optional
var contextMessage : String;
/**
Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.
Optional.
**/
@:optional
var priority : Float;
/**
A timestamp associated with the notification, in milliseconds past the epoch.
Optional.
**/
@:optional
var eventTime : Float;
/**
A URL to the image thumbnail for image-type notifications.
Optional.
**/
@:optional
var imageUrl : String;
/**
Items for multi-item notifications.
Optional.
**/
@:optional
var items : Array<NotificationItem>;
/**
Current progress ranges from 0 to 100.
Optional.
**/
@:optional
var progress : Float;
/**
Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.
Optional.
**/
@:optional
var isClickable : Bool;
};