see this first.
This is proper desktop notifications for node-webkit.
Idea behind is to create drop-in replacement for html5 desktop notifications. Giving though richer and better experience.
Use the lib in your app you need to take 2 files:
src/desktopNotification.js
src/desktopNotification.html
You need to place them in same folder of your app. Load desktopNotification.js
to your index.html to use the DesktopNotification
var notif = new DesktopNotification('Hello', {body: 'World'});
notif.show();
check other ways to use DesktopNotification
in example.
- Fetch the repo.
- npm install
- npm start
- find an app for your OS in build/node-webkit-desktop-notification
- play
##API
Title is the notification's title. Options: body is required.
- width: 288 - width
- height: 96 - height
- body - text body for notification
- icon - icon of notification
- ease - ease function
- htmlBody - notification body as HTML
- styles - additional styles to add for notification
- show - show notification
- close - close notification
- on - set up event listener on notification
- off - remove event listener from notification
- emit - emit event on notification
- onclick - assign function for click event
- onshow - assign function for show event
- onclose - assign function for close event
- onerror - assign function for error event
- body.click - if someone clicks on notification
- show - when notification is shown
- close - when notification is closed
- showStart - when notification start showing animation
- closeStart - when notification start closing animation
- error - on error
- close.click - when user clicks on x to close notification
You can put design your own beautiful notifications by using htmlBody
and styles
options.
Inside in notification window context you have access to window
object which is EventEmitter. You can emit events inside notification with window.emit('eventName')
and catch them on DesktopNotification
instance in your application.
For more details, check example.
You can use following ease functions like DesktopNotification.ease.easeInQuad
, just put it as ease
option in options.
easeInQuad
easeOutQuad
easeInOutQuad
easeInCubic
easeOutCubic
easeInOutCubic
easeInQuart
easeOutQuart
easeInOutQuart
easeInQuint
easeOutQuint
easeInOutQuint
easeInSine
easeOutSine
easeInOutSine
easeInExpo
easeOutExpo
easeInOutExpo
easeInCirc
easeOutCirc
easeInOutCirc
easeInElastic
easeOutElastic
easeInOutElastic
easeInBack
easeOutBack
easeInOutBack
easeInBounce
easeOutBounce