Skip to content

Implement Web Notification API in src/client #394

@yorkie

Description

@yorkie

Feature Request

Implement the Web Notification API in src/client.

Reference:

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()
  • 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 Notification class 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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions