react-timeout
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "react-timeout", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "HOC for React and React Native providing versions of setTimeout etc. that cancels when unmounted.", | ||
@@ -29,2 +29,3 @@ "homepage": "https://github.com/plougsgaard/react-timeout", | ||
"create-react-class": "^15.5.2", | ||
"hoist-non-react-statics": "^2.3.1", | ||
"object-assign": "^4.0.1" | ||
@@ -38,7 +39,7 @@ }, | ||
"babel-preset-stage-1": "^6.1.18", | ||
"chai": "^3.4.1", | ||
"chai": "^4.0.0", | ||
"chai-immutable": "^1.5.3", | ||
"immutable": "^3.8.0", | ||
"jsdom": "^10.1.0", | ||
"mocha": "^3.2.0", | ||
"jsdom": "^11.0.0", | ||
"mocha": "^5.0.0", | ||
"react": "^15.4.2", | ||
@@ -45,0 +46,0 @@ "react-dom": "^15.4.2" |
@@ -60,2 +60,3 @@ # React Timeout | ||
} | ||
export default ReactTimeout(LightSwitchExample) | ||
``` | ||
@@ -93,2 +94,5 @@ | ||
## To access the wrapped instance | ||
If you need access to the component wrapped by `ReactTimeout`, use `component.getWrappedInstance()`. | ||
# Something similar | ||
@@ -95,0 +99,0 @@ |
var createReactClass = require('create-react-class') | ||
var objectAssign = require('object-assign') | ||
var hoistNonReactStatics = require('hoist-non-react-statics') | ||
@@ -56,3 +57,3 @@ var createReactTimeout = function (React) { | ||
var ReactTimeout = function (SourceComponent) { | ||
return createReactClass({ | ||
var Component = createReactClass({ | ||
displayName: 'ReactTimeout', | ||
@@ -79,2 +80,6 @@ | ||
getWrappedInstance() { | ||
return this.wrappedInstance; | ||
}, | ||
render: function () { | ||
@@ -87,2 +92,3 @@ return React.createElement( | ||
{ | ||
ref: (component) => { this.wrappedInstance = component; }, | ||
setTimeout: this.setTimeout, | ||
@@ -102,2 +108,3 @@ clearTimeout: this.clearTimeout, | ||
}) | ||
return hoistNonReactStatics(Component, SourceComponent) | ||
} | ||
@@ -104,0 +111,0 @@ |
28518
96
111
3
+ Addedhoist-non-react-statics@2.5.5(transitive)