react-desktop-notification
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -9,2 +9,8 @@ /** | ||
start: function(title, context, url, icon, name) { | ||
name=name||("notiwin"+(function(n) { | ||
var rnd = ""; | ||
for (var i = 0; i < n; i++) | ||
rnd += Math.floor(Math.random() * 10); | ||
return rnd; | ||
})(5)); | ||
if (!Notification) { | ||
@@ -18,4 +24,5 @@ console.log("Your browser is not support desktop notifications, please try Chrome or Firefox."); | ||
} else { | ||
icon=(icon&&icon.match(/^.*\.(jpeg|jpg|gif|png)/gi))?icon:"http://ob9oayzh3.bkt.clouddn.com/images.png" | ||
var notification = new Notification(title, { | ||
icon: icon || "http://ob9oayzh3.bkt.clouddn.com/images.png", | ||
icon: icon, | ||
body: context, | ||
@@ -22,0 +29,0 @@ }); |
{ | ||
"name": "react-desktop-notification", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Use browser's desktop notification in React. It depends on notifications API of chrome or else browser's other way.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,7 +14,12 @@ ## react-desktop-notification | ||
... | ||
//Here will pop a notifier. | ||
//Here will pop a notifier and always open in a new window when clicked. | ||
Notifier.start("Title","Here is context","www.google.com","validated image url"); | ||
//Here will pop notifier and open in a specified name window "popwin1" when clicked. | ||
Notifier.start("Title","Here is context","www.google.com","validated image url","popwin1"); | ||
... | ||
} | ||
``` | ||
## API | ||
Notifier.start(notifier_title, notifier_context, opening_url, icon_url, window_name) | ||
@@ -21,0 +26,0 @@ ## git |
2644
48
28