Skip to content

Commit d28c6f6

Browse files
committed
Upgrade to babel6
1 parent 651a6ce commit d28c6f6

File tree

7 files changed

+172
-154
lines changed

7 files changed

+172
-154
lines changed

dist/react-notification-system-redux.js

Lines changed: 81 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(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){
2-
'use strict';
3-
4-
Object.defineProperty(exports, '__esModule', {
2+
Object.defineProperty(exports, "__esModule", {
53
value: true
64
});
75

@@ -66,39 +64,21 @@ function hide(uid) {
6664
}
6765

6866
},{"./const":2}],2:[function(require,module,exports){
69-
'use strict';
70-
71-
Object.defineProperty(exports, '__esModule', {
67+
Object.defineProperty(exports, "__esModule", {
7268
value: true
7369
});
74-
var RNS_SHOW_NOTIFICATION = 'RNS_SHOW_NOTIFICATION';
75-
exports.RNS_SHOW_NOTIFICATION = RNS_SHOW_NOTIFICATION;
76-
var RNS_HIDE_NOTIFICATION = 'RNS_HIDE_NOTIFICATION';
77-
exports.RNS_HIDE_NOTIFICATION = RNS_HIDE_NOTIFICATION;
70+
var RNS_SHOW_NOTIFICATION = exports.RNS_SHOW_NOTIFICATION = 'RNS_SHOW_NOTIFICATION';
71+
var RNS_HIDE_NOTIFICATION = exports.RNS_HIDE_NOTIFICATION = 'RNS_HIDE_NOTIFICATION';
7872

7973
},{}],3:[function(require,module,exports){
8074
(function (global){
81-
'use strict';
82-
83-
Object.defineProperty(exports, '__esModule', {
75+
Object.defineProperty(exports, "__esModule", {
8476
value: true
8577
});
8678

8779
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; };
8880

89-
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
90-
91-
var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
92-
93-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
94-
95-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
96-
97-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
98-
99-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
100-
101-
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
81+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10282

10383
var _react = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null);
10484

@@ -116,66 +96,98 @@ var _reactNotificationSystem = require('react-notification-system');
11696

11797
var _reactNotificationSystem2 = _interopRequireDefault(_reactNotificationSystem);
11898

119-
var Notifications = (function (_React$Component) {
99+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
100+
101+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
102+
103+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
104+
105+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
106+
107+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
108+
109+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
110+
111+
var Notifications = function (_React$Component) {
120112
_inherits(Notifications, _React$Component);
121113

122114
function Notifications() {
123115
_classCallCheck(this, Notifications);
124116

125-
_get(Object.getPrototypeOf(Notifications.prototype), 'constructor', this).apply(this, arguments);
117+
return _possibleConstructorReturn(this, (Notifications.__proto__ || Object.getPrototypeOf(Notifications)).apply(this, arguments));
126118
}
127119

128120
_createClass(Notifications, [{
129121
key: 'system',
130-
value: function system() {
131-
return this.refs.notify;
132-
}
122+
value: function () {
123+
function system() {
124+
return this.refs.notify;
125+
}
126+
127+
return system;
128+
}()
133129
}, {
134130
key: 'componentWillReceiveProps',
135-
value: function componentWillReceiveProps(nextProps) {
136-
var _this = this;
131+
value: function () {
132+
function componentWillReceiveProps(nextProps) {
133+
var _this2 = this;
137134

138-
var notifications = nextProps.notifications;
135+
var notifications = nextProps.notifications;
139136

140-
var notificationIds = notifications.map(function (notification) {
141-
return notification.uid;
142-
});
137+
var notificationIds = notifications.map(function (notification) {
138+
return notification.uid;
139+
});
143140

144-
// Get all active notifications from react-notification-system
145-
/// and remove all where uid is not found in the reducer
146-
(this.system().state.notifications || []).forEach(function (notification) {
147-
if (notificationIds.indexOf(notification.uid) < 0) {
148-
_this.system().removeNotification(notification.uid);
149-
}
150-
});
151-
152-
notifications.forEach(function (notification) {
153-
_this.system().addNotification(_extends({}, notification, {
154-
onRemove: function onRemove() {
155-
_this.context.store.dispatch(actions.hide(notification.uid));
141+
// Get all active notifications from react-notification-system
142+
/// and remove all where uid is not found in the reducer
143+
(this.system().state.notifications || []).forEach(function (notification) {
144+
if (notificationIds.indexOf(notification.uid) < 0) {
145+
_this2.system().removeNotification(notification.uid);
156146
}
157-
}));
158-
});
159-
}
147+
});
148+
149+
notifications.forEach(function (notification) {
150+
_this2.system().addNotification(_extends({}, notification, {
151+
onRemove: function () {
152+
function onRemove() {
153+
_this2.context.store.dispatch(actions.hide(notification.uid));
154+
}
155+
156+
return onRemove;
157+
}()
158+
}));
159+
});
160+
}
161+
162+
return componentWillReceiveProps;
163+
}()
160164
}, {
161165
key: 'shouldComponentUpdate',
162-
value: function shouldComponentUpdate(nextProps) {
163-
return this.props !== nextProps;
164-
}
166+
value: function () {
167+
function shouldComponentUpdate(nextProps) {
168+
return this.props !== nextProps;
169+
}
170+
171+
return shouldComponentUpdate;
172+
}()
165173
}, {
166174
key: 'render',
167-
value: function render() {
168-
var _props = this.props;
169-
var notifications = _props.notifications;
175+
value: function () {
176+
function render() {
177+
var _props = this.props;
178+
var notifications = _props.notifications;
170179

171-
var rest = _objectWithoutProperties(_props, ['notifications']);
180+
var rest = _objectWithoutProperties(_props, ['notifications']);
172181

173-
return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: 'notify' }, rest));
174-
}
182+
return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: 'notify' }, rest));
183+
}
184+
185+
return render;
186+
}()
175187
}]);
176188

177189
return Notifications;
178-
})(_react2['default'].Component);
190+
}(_react2['default'].Component);
179191

180192
Notifications.propTypes = {
181193
notifications: _react.PropTypes.array
@@ -193,34 +205,32 @@ Object.keys(actions).forEach(function (key) {
193205
Notifications.reducer = _reducer2['default'];
194206

195207
exports['default'] = Notifications;
196-
module.exports = exports['default'];
197208

198209
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
199210
},{"./actions":1,"./reducer":4,"react-notification-system":undefined}],4:[function(require,module,exports){
200-
'use strict';
201-
202-
Object.defineProperty(exports, '__esModule', {
211+
Object.defineProperty(exports, "__esModule", {
203212
value: true
204213
});
205214

206215
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; };
207216

208217
exports['default'] = Notifications;
209218

210-
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
219+
var _const = require('./const');
211220

212-
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
221+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
213222

214-
var _const = require('./const');
223+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
215224

216225
function Notifications() {
217226
var state = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
218227
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
219228

220229
switch (action.type) {
221230
case _const.RNS_SHOW_NOTIFICATION:
222-
var type = action.type,
223-
rest = _objectWithoutProperties(action, ['type']);
231+
var type = action.type;
232+
233+
var rest = _objectWithoutProperties(action, ['type']);
224234

225235
return [].concat(_toConsumableArray(state), [_extends({}, rest, { uid: action.uid })]);
226236
case _const.RNS_HIDE_NOTIFICATION:
@@ -231,7 +241,5 @@ function Notifications() {
231241
return state;
232242
}
233243

234-
module.exports = exports['default'];
235-
236244
},{"./const":2}]},{},[3])(3)
237245
});

0 commit comments

Comments
 (0)