ladybird/Libraries/LibWeb/NotificationsAPI/Notification.idl
Niccolo Antonelli Dziri bd76078f97 LibWeb: Add constructor for Notification and getter methods
The full constructor for NotificationsAPI::Notification is implemented
along with the getter methods.
It is now possible to call the elements of Notification in JS without
getting undefined but the default values (or the ones passed in
options).

The method `current_wall_time` is added in EnvironmentSettingsObject.

This passes a least a few more tests because of the getter methods
that are created.

https://wpt.live/notifications/constructor-basic.https.html

https://wpt.live/notifications/idlharness.https.any.html
2026-02-13 16:47:42 +00:00

76 lines
2.3 KiB
Text

#import <DOM/EventTarget.idl>
#import <HighResolutionTime/EpochTimeStamp.idl>
// https://notifications.spec.whatwg.org/#notification
[Exposed=(Window,Worker)]
interface Notification : EventTarget {
constructor(DOMString title, optional NotificationOptions options = {});
// FIXME: static readonly attribute NotificationPermission permission;
// FIXME: [Exposed=Window] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback);
static readonly attribute unsigned long maxActions;
[FIXME] attribute EventHandler onclick;
[FIXME] attribute EventHandler onshow;
[FIXME] attribute EventHandler onerror;
[FIXME] attribute EventHandler onclose;
readonly attribute Utf16DOMString title;
readonly attribute NotificationDirection dir;
readonly attribute Utf16DOMString lang;
readonly attribute Utf16DOMString body;
readonly attribute USVString navigate;
readonly attribute Utf16DOMString tag;
readonly attribute USVString image;
readonly attribute USVString icon;
readonly attribute USVString badge;
// FIXME: [SameObject] readonly attribute FrozenArray<unsigned long> vibrate;
readonly attribute EpochTimeStamp timestamp;
readonly attribute boolean renotify;
readonly attribute boolean? silent;
readonly attribute boolean requireInteraction;
[SameObject] readonly attribute any data;
[SameObject] readonly attribute FrozenArray<NotificationAction> actions;
[FIXME] undefined close();
};
dictionary NotificationOptions {
NotificationDirection dir = "auto";
DOMString lang = "";
DOMString body = "";
USVString navigate;
DOMString tag = "";
USVString image;
USVString icon;
USVString badge;
// FIXME: VibratePattern vibrate;
EpochTimeStamp timestamp;
boolean renotify = false;
boolean? silent = null;
boolean requireInteraction = false;
any data = null;
sequence<NotificationAction> actions = [];
};
enum NotificationPermission {
"default",
"denied",
"granted"
};
enum NotificationDirection {
"auto",
"ltr",
"rtl"
};
dictionary NotificationAction {
required DOMString action;
required DOMString title;
USVString navigate;
USVString icon;
};
[FIXME] callback NotificationPermissionCallback = undefined (NotificationPermission permission);