react-notification-system-redux
Advanced tools
Comparing version
@@ -150,2 +150,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.notifications = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
_this2.context.store.dispatch(actions.hide(notification.uid)); | ||
notification.onRemove && notification.onRemove(); | ||
} | ||
@@ -152,0 +153,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.notifications=e()}}(function(){return function e(t,n,r){function o(u,f){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[u]={exports:{}};t[u][0].call(s.exports,function(e){var n=t[u][1][e];return o(n?n:e)},s,s.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){function r(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments.length<=1||void 0===arguments[1]?"success":arguments[1];return a({type:s.RNS_SHOW_NOTIFICATION},e,{uid:e.uid||Date.now(),level:t})}function o(e){return r(e,"success")}function i(e){return r(e,"error")}function u(e){return r(e,"warning")}function f(e){return r(e,"info")}function c(e){return{type:s.RNS_HIDE_NOTIFICATION,uid:e}}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n.show=r,n.success=o,n.error=i,n.warning=u,n.info=f,n.hide=c;var s=e("./const")},{"./const":2}],2:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});n.RNS_SHOW_NOTIFICATION="RNS_SHOW_NOTIFICATION",n.RNS_HIDE_NOTIFICATION="RNS_HIDE_NOTIFICATION"},{}],3:[function(e,t,n){(function(n){function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l="undefined"!=typeof window?window.React:"undefined"!=typeof n?n.React:null,p=o(l),d=e("./actions"),y=r(d),O=e("./reducer"),v=o(O),h=e("react-notification-system"),_=o(h),b=function(e){function t(){return u(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),s(t,[{key:"system",value:function(){function e(){return this.refs.notify}return e}()},{key:"componentWillReceiveProps",value:function(){function e(e){var t=this,n=e.notifications,r=n.map(function(e){return e.uid});(this.system().state.notifications||[]).forEach(function(e){r.indexOf(e.uid)<0&&t.system().removeNotification(e.uid)}),n.forEach(function(e){t.system().addNotification(a({},e,{onRemove:function(){function n(){t.context.store.dispatch(y.hide(e.uid))}return n}()}))})}return e}()},{key:"shouldComponentUpdate",value:function(){function e(e){return this.props!==e}return e}()},{key:"render",value:function(){function e(){var e=this.props,t=(e.notifications,i(e,["notifications"]));return p["default"].createElement(_["default"],a({ref:"notify"},t))}return e}()}]),t}(p["default"].Component);b.propTypes={notifications:l.PropTypes.array},b.contextTypes={store:l.PropTypes.object},Object.keys(y).forEach(function(e){b[e]=y[e]}),b.reducer=v["default"],t.exports=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":1,"./reducer":4,"react-notification-system":void 0}],4:[function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];switch(t.type){case f.RNS_SHOW_NOTIFICATION:var n=(t.type,o(t,["type"]));return[].concat(r(e),[u({},n,{uid:t.uid})]);case f.RNS_HIDE_NOTIFICATION:return e.filter(function(e){return e.uid!==t.uid})}return e}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n["default"]=i;var f=e("./const")},{"./const":2}]},{},[3])(3)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.notifications=e()}}(function(){return function e(t,n,r){function o(u,f){if(!n[u]){if(!t[u]){var c="function"==typeof require&&require;if(!f&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[u]={exports:{}};t[u][0].call(s.exports,function(e){var n=t[u][1][e];return o(n?n:e)},s,s.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){function r(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments.length<=1||void 0===arguments[1]?"success":arguments[1];return a({type:s.RNS_SHOW_NOTIFICATION},e,{uid:e.uid||Date.now(),level:t})}function o(e){return r(e,"success")}function i(e){return r(e,"error")}function u(e){return r(e,"warning")}function f(e){return r(e,"info")}function c(e){return{type:s.RNS_HIDE_NOTIFICATION,uid:e}}Object.defineProperty(n,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n.show=r,n.success=o,n.error=i,n.warning=u,n.info=f,n.hide=c;var s=e("./const")},{"./const":2}],2:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});n.RNS_SHOW_NOTIFICATION="RNS_SHOW_NOTIFICATION",n.RNS_HIDE_NOTIFICATION="RNS_HIDE_NOTIFICATION"},{}],3:[function(e,t,n){(function(n){function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l="undefined"!=typeof window?window.React:"undefined"!=typeof n?n.React:null,p=o(l),d=e("./actions"),y=r(d),v=e("./reducer"),O=o(v),h=e("react-notification-system"),_=o(h),b=function(e){function t(){return u(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return c(t,e),s(t,[{key:"system",value:function(){function e(){return this.refs.notify}return e}()},{key:"componentWillReceiveProps",value:function(){function e(e){var t=this,n=e.notifications,r=n.map(function(e){return e.uid});(this.system().state.notifications||[]).forEach(function(e){r.indexOf(e.uid)<0&&t.system().removeNotification(e.uid)}),n.forEach(function(e){t.system().addNotification(a({},e,{onRemove:function(){function n(){t.context.store.dispatch(y.hide(e.uid)),e.onRemove&&e.onRemove()}return n}()}))})}return e}()},{key:"shouldComponentUpdate",value:function(){function e(e){return this.props!==e}return e}()},{key:"render",value:function(){function e(){var e=this.props,t=(e.notifications,i(e,["notifications"]));return p["default"].createElement(_["default"],a({ref:"notify"},t))}return e}()}]),t}(p["default"].Component);b.propTypes={notifications:l.PropTypes.array},b.contextTypes={store:l.PropTypes.object},Object.keys(y).forEach(function(e){b[e]=y[e]}),b.reducer=O["default"],t.exports=b}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./actions":1,"./reducer":4,"react-notification-system":void 0}],4:[function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function i(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];switch(t.type){case f.RNS_SHOW_NOTIFICATION:var n=(t.type,o(t,["type"]));return[].concat(r(e),[u({},n,{uid:t.uid})]);case f.RNS_HIDE_NOTIFICATION:return e.filter(function(e){return e.uid!==t.uid})}return e}Object.defineProperty(n,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};n["default"]=i;var f=e("./const")},{"./const":2}]},{},[3])(3)}); |
@@ -76,2 +76,3 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
_this2.context.store.dispatch(actions.hide(notification.uid)); | ||
notification.onRemove && notification.onRemove(); | ||
} | ||
@@ -78,0 +79,0 @@ |
{ | ||
"name": "react-notification-system-redux", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "react-notification-system-redux", | ||
@@ -5,0 +5,0 @@ "main": "lib/notifications.js", |
@@ -31,2 +31,3 @@ import React, {PropTypes} from 'react'; | ||
this.context.store.dispatch(actions.hide(notification.uid)); | ||
notification.onRemove && notification.onRemove(); | ||
} | ||
@@ -33,0 +34,0 @@ }); |
41947
0.52%672
0.45%