diff --git a/modules/default/alert/README.md b/modules/default/alert/README.md index 74df29a5..f76549ba 100644 --- a/modules/default/alert/README.md +++ b/modules/default/alert/README.md @@ -70,11 +70,18 @@ The following properties can be configured: ## Developer notes +For notifications use: -### Display notification ``` -self.sendNotification("SHOW_NOTIFICATION", {title: "Hello", message: "This is a test!"}); +self.sendNotification("SHOW_ALERT", {type: "notification"}); ``` +For alerts use: + +``` +self.sendNotification("SHOW_ALERT", {type: "alert"}); +``` + +### Notification params @@ -99,10 +106,7 @@ self.sendNotification("SHOW_NOTIFICATION", {title: "Hello", message: "This is a
-### Display alert -``` -self.sendNotification("SHOW_ALERT", {title: "Hello", message: "This is a test!", imageUrl:"url", imageHeight: "30px", timer:2}); -``` +### Alert params @@ -149,8 +153,6 @@ self.sendNotification("SHOW_ALERT", {title: "Hello", message: "This is a test!",
- - ## Open Source Licenses ###[NotificationStyles](https://github.com/codrops/NotificationStyles) See [ympanus.net](http://tympanus.net/codrops/licensing/) for license. \ No newline at end of file diff --git a/modules/default/alert/alert.js b/modules/default/alert/alert.js index 73ffcd27..03fcf1c2 100644 --- a/modules/default/alert/alert.js +++ b/modules/default/alert/alert.js @@ -14,7 +14,7 @@ Module.register('alert',{ // scale|slide|genie|jelly|flip|bouncyflip|exploader alert_effect:"jelly", //time a notification is displayed in seconds - display_time: 3.5, + display_time: 3500, //Position position: "center", //shown at startup @@ -32,18 +32,13 @@ Module.register('alert',{ message : message, layout : "growl", effect : this.config.effect, - ttl: this.config.display_time * 1000 + ttl: this.config.display_time }).show(); }, show_alert: function (params, sender) { var self = this //Set standard params if not provided by module - if (typeof params.timer === 'undefined') { - params.timer = null; - } - else { - params.timer = params.timer * 1000 - } + if (typeof params.timer === 'undefined') { params.timer = null; } if (typeof params.imageHeight === 'undefined') { params.imageHeight = "80px"; } if (typeof params.imageUrl === 'undefined') { params.imageUrl = null; @@ -99,11 +94,13 @@ Module.register('alert',{ }, notificationReceived: function(notification, payload, sender) { - if (notification === 'SHOW_NOTIFICATION') { - this.show_notification(payload) - } - else if (notification === 'SHOW_ALERT') { - this.show_alert(payload, sender) + if (notification === 'SHOW_ALERT') { + if (payload.type == "alert"){ + this.show_alert(payload, sender) + } + else if (payload.type = "notification"){ + this.show_notification(payload) + } } else if (notification === 'HIDE_ALERT') { this.hide_alert(sender)