Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
notifications-library
Advanced tools
Notifications-library is a small and simple library in TypeScript to manage a notifications system
Readme
Notifications-library is a small and simple library in TypeScript to manage a notifications system
Create an instance of the NotificationCenter
const notificationCenterObject = new NotificationCenter;
If you want to use a remote system, set the configuration
const configuration = { fetchUrl: 'anyValidURL1',
createUrl: 'anyValidURL2',
updateUrl:'anyValidURL3' };
notificationCenterObject.setConfig(configuration);
otherwise you can have a full local system.
You can set the sender of the notifications
const sender = 'AnyValidSender';
notificationCenterObject.setSender(sender);
There are different methods offered by the NotificationCenter class
This method allow the user to get the notifications list
await notificationCenterObject.getAllNotifications();
This method allow the user to get a specific notification by passing its ID as argument
// notification.id is the id of the notification you want to get
const requestedNotification = await notificationCenterObject.getNotificationByID(notification.id);
This method allow the user to send a notification
const notification = {
title: 'There is a new notification',
message: 'Hello, im the first notification!'
};
await notificationCenterObject.sendNotification(notification);
This method allow the user to mark a specific notification by passing its ID as argument
// notification.id is the id of the notification you want to mark as read
await notificationCenterObject.markNotificationAsRead(notification.id);
This method allow the user to mark all the notifications as read
await notificationCenterObject.markAllAsRRead();
This method allow the user to delete a specific notification by passing its ID as argument
// notification.id is the id of the notification you want to delete
await notificationCenterObject.deleteNotificationByID(notification.id);
This method allow the user to delete all the notifications
await notificationCenterObject.deleteAllNotifications();
This method allow the user to subscribe to the NotificationCenter and get notify each time a new notification is sent or read
// This function will be called each time a new notification is sent or read
function onNewNotification(notification: Notification) {
console.log(notification);
}
// onNewNotification is subscribed
notificationCenterObject.addSubscriber(onNewNotification);
FAQs
Notifications-library is a small and simple library in TypeScript to manage a notifications system
The npm package notifications-library receives a total of 0 weekly downloads. As such, notifications-library popularity was classified as not popular.
We found that notifications-library demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.