UNPKG

unnotify

Version:

Pure JS growlish notifications with zero dependencies, simple API written in TypeScript.

53 lines (37 loc) 1.67 kB
# unnotify **Project has migrated to [@unaxiom/unnotify](https://www.npmjs.com/package/@unaxiom/unnotify). This package is only for legacy purposes.** Pure JS growlish notifications with zero dependencies, simple API written in TypeScript. No jQuery needed either. ## Installation ```bash user@username ~> npm install unnotify --save ``` - If integrating using browserify: In your typescript files, import as: ```ts import * as unnotify from 'unnotify'; ``` - If integrating to webpage: ```html <script src="dist/unnotify.min.js" type="text/javascript"></script> ``` ## Usage ```js // Initialization is required just once across all the files. unnotify.init(); // To display a notification var notificationID = unnotify.show('This is the Title', 'This is the content', { type: 'success' | 'info' | 'warning' | 'danger' | 'custom', timeout: 5000, // Number of milliseconds for which this notification needs to be displayed. If value is 0, then it won't be automatically destroyed. customClass: '', // (**Optional**) Name of the custom class that will be used instead of builtin classes. For this to be used, **type** should be set to 'custom'. animateIn: 'lightSpeedIn', // (**Optional**) Name of the animation class (from animate.css) that needs to be used while creating the notification. animateOut: 'bounceOut', // (**Optional**) Name of the animation class (from animate.css) that needs to be used while destroying the notification. }) // To close the notification programatically unnotify.destroy(notificationID); ``` ## Dev ```bash user@username ~> npm install user@username ~> gulp ``` Make necessary code changes in unnotify.ts