forked from Ambroos/react-nested-status
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (30 loc) · 766 Bytes
/
Copy pathindex.js
File metadata and controls
38 lines (30 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
var React = require('react'),
createSideEffect = require('react-side-effect');
var _serverStatus = 200;
function getStatusFromPropsList(propsList) {
var innermostProps = propsList[propsList.length - 1];
if (innermostProps) {
return innermostProps.code;
}
}
var NestedStatus = createSideEffect(function handleChange(propsList) {
var status = getStatusFromPropsList(propsList);
_serverStatus = status || 200;
}, {
displayName: 'NestedStatus',
propTypes: {
code: React.PropTypes.number.isRequired
},
statics: {
peek: function () {
return _serverStatus;
},
rewind: function () {
var status = _serverStatus;
this.dispose();
return status;
}
}
});
module.exports = NestedStatus;