-
Notifications
You must be signed in to change notification settings - Fork 3
Labels
enhancementNew feature or requestNew feature or request
Description
Feature Request
Implement the Web Notification API in src/client.
Reference:
- Web Notification API Spec: https://developer.mozilla.org/en-US/docs/Web/API/Notification
Requirements:
- Provide a Notification class in C++ (e.g.,
src/client/dom/notification.hpp/.cpp) with the following features:- Constructor:
Notification(title, options) - Static property:
Notification.permission - Static method:
Notification.requestPermission() - Instance properties:
title,body,icon,tag,data,requireInteraction, etc. - Event handlers:
onshow,onclick,onclose,onerror - Method:
close()
- Constructor:
- JS binding so Notification can be constructed from JavaScript.
- Permission model (stub is acceptable for first step).
- On desktop: use native notification APIs (e.g., macOS NSUserNotification, Windows Toast Notification, Linux libnotify). On XR: use JSAR internal popup or 3D UI.
- Support event delivery to JS via callback.
- Follow the API shape and behavior described in the MDN documentation and Chromium's implementation:
Implementation Notes:
- See Chromium's
Notificationclass for reference: notification.cc - JSAR should aim for spec-compliant behavior and extensibility for XR/3D notification display.
Acceptance Criteria:
- JavaScript code can construct new Notification instances with options.
- Notifications display appropriately on all platforms JSAR supports (desktop and XR).
- Permission model is present (even if stub).
- All standard events are supported and delivered to JS.
- API is documented and tested.
Web spec: https://www.w3.org/TR/notifications/
MDN: https://developer.mozilla.org/en-US/docs/Web/API/Notification
Chromium implementation: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/notifications/notification.cc
Copilot
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request