notyjs
v1.0.4
Published
Notificaciones personalizadas
Downloads
5
Readme
NotyJS
NotyJS is a lightweight JavaScript library for displaying customizable notifications in your web applications.
Installation
You can install the package using npm or yarn:
npm install notyjs
# or
yarn add notyjs
Usage
Here's how you can use Custom Notification in your JavaScript or TypeScript code:
import CustomNotification from 'notyjs';
const notification = new CustomNotification('Hello, world!');
notification.show();
Custom Notification also allows you to customize notification options:
const customOptions = {
duration: 3000, // 3 seconds
bgColor: 'blue',
color: 'white',
border: '2px solid yellow'
};
const notification = new CustomNotification('Customized Notification', customOptions);
notification.show();
API Documentation
CustomNotification(message: string, options?: CustomNotificationOptions)
Creates a new CustomNotification
instance with the specified message
and optional options
.
message
: The message to display in the notification.options
(optional): An object containing customization options (see below).
show()
Displays the notification on the screen.
CustomNotificationOptions
These are the customizable options you can pass when creating a CustomNotification
instance:
duration
(default:5000
): The duration of the notification in milliseconds.bgColor
(default:'white'
): The background color of the notification.color
(default:'black'
): The text color of the notification.border
(default:'1px solid rgba(0,0,0,0.3)'
): The border style of the notification.