1.1.0 • Published 4 years ago

@dacoto/notify.js v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

A library to show nice notifications in web application.

VIEW DEMO

Installation

// npm install
npm install @dacoto/notify.js

// yarn install
npm add @dacoto/notify.js

Usage

Include
    import Notify from '@dacoto/notify.js';
CDN
    <script src="//cdn.jsdelivr.net/npm/@dacoto/notify.js/dist/notify.min.js"></script>

Notification example

let options = {
    title: 'Notification title',
    message: 'Notification message',
    icon: 'fas fa-home',
};
let type = 'primary';

var notification = new Notify(options, type);

notification.open();
notification.close();

Notification Params

Options

PropsDefault valueDescriptionTypeRequired
titleNotification titlestringX
messageNotification messagestringX
iconnotify-icon notify-icon-primaryClass of notification icon, similar to this:<i class="notify-icon notify-icon-primary"></i>string
linkLink at the end of the notification (see link table)array
width420Width in pixels of the notificationinteger
duration0The amount of time in milliseconds before closing the notification. 0 means never closedinteger
autoOpentrueOpen the notification when instantiate itboolean
onOpenCallback for the open eventfunction
onCloseCallback for the hide eventfunction

Link

PropsNoteTypeRequired
linkHrefLink urlurlX
linkClassLink classstringX
linkTextLink textstringX

Type

PropColorIcon
primary#4d9aff
success#59d9a4
warning#ffc400
danger#ff542e

Notification methods

NameNote
open()Opens the notification
close()Closes the notification

License

MIT

1.1.0

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.1

5 years ago