@nacrejs/user-notifications
v0.0.1
Published
Nacre 的通知能力:发本地通知,收到通知和通知被点了的事件。装了才有 UNUserNotificationCenter
Readme
@nacrejs/user-notifications
A capability package for Nacre, a JavaScript runtime for iOS apps: local notifications, and events when a notification arrives or is tapped. It provides UNUserNotificationCenter and the classes around it. The app has it only if the project installs this package.
The permission prompt for notifications uses the system's own wording, so there is no usage description to write.
Install
In a Nacre project, two steps.
1. Install the package.
npm install @nacrejs/user-notifications2. Bring in its types at the top of the entry file.
/// <reference types="@nacrejs/types" />
/// <reference types="@nacrejs/user-notifications" />Effect: after you regenerate ios/ and rebuild, the app includes this capability, and typeof UNUserNotificationCenter !== 'undefined' is true.
Without the package, its classes don't exist: reading one throws ReferenceError, and type checking reports it first.
For how to use it, see Notifications. For all capability packages, see Core and capability packages.
License
FSL-1.1-MIT, see LICENSE.md.
