/* * Copyright (c) 2025, Niccolo Antonelli-Dziri * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace Web::NotificationsAPI { struct NotificationAction { String action; String title; Optional navigate; Optional icon; }; struct NotificationOptions { Bindings::NotificationDirection dir = Bindings::NotificationDirection::Auto; String lang = ""_string; String body = ""_string; Optional navigate; String tag = ""_string; Optional image; Optional icon; Optional badge; // VibratePattern vibrate; // FIXME: properly implement vibrate pattern Optional timestamp; bool renotify = false; Optional silent; bool require_interaction = false; JS::Value data; Vector actions; }; // https://notifications.spec.whatwg.org/#notifications class WEB_API Notification final : public DOM::EventTarget { WEB_PLATFORM_OBJECT(Notification, DOM::EventTarget); GC_DECLARE_ALLOCATOR(Notification); public: [[nodiscard]] static WebIDL::ExceptionOr> construct_impl( JS::Realm& realm, String title, Optional options); private: Notification(JS::Realm&); virtual void initialize(JS::Realm&) override; }; }