expiring-redux-messages
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -13,6 +13,9 @@ 'use strict'; | ||
function showMessage(message, lifetime) { | ||
var rating = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; | ||
return { | ||
type: _types.SHOW_MESSAGE, | ||
message: message, | ||
lifetime: lifetime | ||
lifetime: lifetime, | ||
rating: rating | ||
}; | ||
@@ -22,6 +25,9 @@ } | ||
function addMessage(message, id) { | ||
var rating = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; | ||
return { | ||
type: _types.ADD_MESSAGE, | ||
message: message, | ||
id: id | ||
id: id, | ||
rating: rating | ||
}; | ||
@@ -28,0 +34,0 @@ } |
@@ -28,2 +28,3 @@ 'use strict'; | ||
var lifetime = action.lifetime; | ||
var rating = action.rating; | ||
@@ -36,5 +37,5 @@ var id = (0, _helpers.pseudoRandomID)(); | ||
return store.dispatch((0, _actions.addMessage)(message, id)); | ||
return store.dispatch((0, _actions.addMessage)(message, id, rating)); | ||
}; | ||
}; | ||
}; |
@@ -24,3 +24,4 @@ 'use strict'; | ||
id: action.id, | ||
message: action.message | ||
message: action.message, | ||
rating: action.rating | ||
}]); | ||
@@ -27,0 +28,0 @@ case _types.REMOVE_MESSAGE: |
{ | ||
"name": "expiring-redux-messages", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "create messages that will remove themselves", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -32,3 +32,3 @@ #Expiring Redux Messages | ||
store.dispatch( | ||
sendMessage(message, 10000) | ||
sendMessage(message, 10000, 1) | ||
); | ||
@@ -54,1 +54,9 @@ | ||
``` | ||
##`sendMessage` | ||
`sendMessage` takes three arguments: | ||
1. message (string) - the message that should be displayed | ||
2. lifetime (int) - the number of milliseconds that the message should last for | ||
3. rating (int) - the rating of the message. While not required, a good way to think about the rating is to coincide it with its sign. A rating that is less than 0 is negative, a rating that is greater than 0 is positive, and a rating of 0 is neutral. If you do not provide a rating, it will default to 0. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8341
148
61