Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
piral-notifications
Advanced tools
This is a plugin that only has a peer dependency to piral-core
. What piral-notifications
brings to the table is a set of Pilet API extensions that can be used with piral
or piral-core
to show notifications triggered by pilets in your Piral instance.
The following functions are brought to the Pilet API.
showNotification()
Shows a notification inside the app shell. The notification can be permanent (to be closed by the user) or temporary (closes after a specified time).
The provided library only brings API extensions for pilets to a Piral instance.
For the setup of the library itself you'll need to import createNotificationsApi
from the piral-notifications
package.
import { createNotificationsApi } from 'piral-notifications';
The integration looks like:
const instance = createInstance({
// important part
extendApi: [createNotificationsApi()],
// ...
});
Via the options the initially displayed messages
can be defined. Additionally, the defaultOptions
can be set up.
For example:
const instance = createInstance({
// important part
extendApi: [createNotificationsApi({
defaultOptions: {
type: 'warning',
},
messages: [
{
content: 'Welcome to the future of digital services!',
options: {
title: 'Hello!',
type: 'success',
},
},
],
})],
// ...
});
In order to host the toast notifications you'll need to embed the Notifications
component somewhere in your layout.
As an example:
import { Notifications } from 'piral-notifications';
const MyLayout = ({ children }) => {
<div>
<Notifications />
{children}
</div>
};
If you want to customize the styling (which you should) make sure to register components such as NotificationsHost
(shell for the notifications) or NotificationsToast
(wrapper for an individual notification) via, e.g., <SetComponent name="NotificationsHost" component={MyNotificationsHost} />
.
Piral is released using the MIT license. For more information see the license file.
0.9.9 (January 29, 2020)
FAQs
Plugin for triggering notifications in Piral.
The npm package piral-notifications receives a total of 1,492 weekly downloads. As such, piral-notifications popularity was classified as popular.
We found that piral-notifications demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.