
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A simple, lightweight notification library for web applications with TypeScript support
A lightweight, TypeScript-first notification library for web applications. Zero dependencies, fully customizable, and easy to use. Supports both in-page toast notifications and native browser notifications.
pnpm add notifybox
import { notifications } from "notifybox";
// Show different types of toast notifications
notifications.success("Operation completed successfully!");
notifications.error("Something went wrong!");
notifications.warning("Please check your input");
notifications.info("Here's some information");
import { notifications } from "simple-notifications";
// Request permission first (or configure auto-request)
await notifications.requestBrowserPermission();
// Show browser notifications
await notifications.browserSuccess("Task completed!");
await notifications.browserError("Error occurred!");
// Or use mode option
await notifications.success("Done!", { mode: "browser" });
// 'auto' mode uses browser notifications when page is hidden, toast when visible
notifications.info("New message received", { mode: "auto" });
import { NotificationManager } from "notifybox";
const customNotifications = new NotificationManager({
defaultDuration: 6000,
defaultPosition: "top-left",
maxNotifications: 3,
defaultMode: "auto",
requestPermissionOnInit: true,
fallbackToToast: true,
browserNotificationOptions: {
icon: "/my-app-icon.png",
badge: "/my-badge.png",
},
});
notifications.info("New message from John", {
mode: "browser",
icon: "/user-avatar.jpg",
image: "/message-preview.jpg",
actions: [
{ action: "reply", title: "Reply", icon: "/reply-icon.png" },
{ action: "mark-read", title: "Mark as Read" },
],
onClick: () => {
// Handle notification click
window.focus();
// Navigate to message
},
});
notifications.success("Success!", {
mode: "toast",
duration: 8000,
position: "bottom-center",
closable: false,
onClick: () => console.log("Toast clicked!"),
onClose: () => console.log("Toast closed!"),
});
// Check browser notification support
if (notifications.hasBrowserSupport()) {
console.log("Browser notifications are supported");
}
// Check current permission status
if (notifications.hasBrowserPermission()) {
console.log("Browser notifications are allowed");
}
// Request permission manually
const permission = await notifications.requestBrowserPermission();
if (permission === "granted") {
console.log("Permission granted!");
}
// Create a notification that doesn't auto-dismiss
const notification = await notifications.info("Processing...", {
duration: 0,
mode: "toast",
});
// Later, remove it manually (only works for toast notifications)
if (notification instanceof NotificationElement) {
notification.remove();
}
// Clear all toast notifications
notifications.clear();
The main class for managing notifications.
interface NotificationConfig {
defaultDuration?: number; // Default auto-dismiss time (4000ms)
defaultPosition?: string; // Default position ('top-right')
maxNotifications?: number; // Max concurrent toasts (5)
className?: string; // Custom CSS class
defaultMode?: NotificationMode; // 'toast' | 'browser' | 'auto'
requestPermissionOnInit?: boolean; // Request permission on init (false)
fallbackToToast?: boolean; // Fallback to toast if browser fails (true)
browserNotificationOptions?: {
// Default browser notification options
icon?: string;
badge?: string;
image?: string;
};
}
show(message, options?) - Show notification with specified modesuccess(message, options?) - Show success notificationerror(message, options?) - Show error notificationwarning(message, options?) - Show warning notificationinfo(message, options?) - Show info notificationbrowserSuccess(message, options?) - Force browser success notificationbrowserError(message, options?) - Force browser error notificationbrowserWarning(message, options?) - Force browser warning notificationbrowserInfo(message, options?) - Force browser info notificationclear() - Remove all toast notificationsrequestBrowserPermission() - Request browser notification permissionhasBrowserSupport() - Check if browser notifications are supportedhasBrowserPermission() - Check if permission is grantedinterface NotificationOptions {
// Common options
type?: "success" | "error" | "warning" | "info";
duration?: number; // Auto-dismiss time (0 = never)
onClick?: () => void; // Click handler
onClose?: () => void; // Close handler
// Mode selection
mode?: "toast" | "browser" | "auto";
// Toast-specific options
position?:
| "top-right"
| "top-left"
| "bottom-right"
| "bottom-left"
| "top-center"
| "bottom-center";
closable?: boolean; // Show close button (default: true)
// Browser-specific options
icon?: string; // Notification icon URL
image?: string; // Large image URL
badge?: string; // Small badge icon URL
tag?: string; // Notification tag for grouping
requireInteraction?: boolean; // Require user interaction to dismiss
silent?: boolean; // Silent notification
actions?: NotificationAction[]; // Action buttons
}
interface NotificationAction {
action: string; // Unique action identifier
title: string; // Button text
icon?: string; // Button icon URL
}
mode: 'toast')mode: 'browser')mode: 'auto')The library handles browser notification permissions gracefully:
const chatNotifications = new NotificationManager({
defaultMode: "auto",
requestPermissionOnInit: true,
browserNotificationOptions: {
icon: "/chat-icon.png",
},
});
// New message notification
chatNotifications.info(`New message from ${sender}`, {
mode: "auto",
onClick: () => {
window.focus();
openChat(senderId);
},
});
// Error notifications stay on page
notifications.error("Please fill in all required fields", {
mode: "toast",
duration: 6000,
position: "top-center",
});
// Success can use browser notification
notifications.success("Form submitted successfully!", {
mode: "browser",
duration: 3000,
});
// Long-running task completion
notifications.success("Export completed successfully!", {
mode: "browser",
requireInteraction: true,
actions: [
{ action: "download", title: "Download File" },
{ action: "view", title: "View Results" },
],
});
MIT
FAQs
A simple, lightweight notification library for web applications with TypeScript support
We found that notifybox demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.