react-hot-api
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -9,3 +9,3 @@ 'use strict'; | ||
*/ | ||
module.exports = function makeMakeHot() { | ||
module.exports = function makeMakeHot(ReactMount) { | ||
var patchers = {}; | ||
@@ -26,3 +26,3 @@ | ||
if (!patchers[persistentId]) { | ||
patchers[persistentId] = makePatchReactClass(); | ||
patchers[persistentId] = makePatchReactClass(ReactMount); | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -10,3 +10,3 @@ 'use strict'; | ||
*/ | ||
module.exports = function makePatchReactClass() { | ||
module.exports = function makePatchReactClass(ReactMount) { | ||
var assimilatePrototype = makeAssimilatePrototype(), | ||
@@ -26,6 +26,9 @@ FirstClass = null; | ||
assimilatePrototype(nextPrototype); | ||
requestForceUpdateAll(); | ||
if (FirstClass) { | ||
requestForceUpdateAll(ReactMount); | ||
} | ||
return FirstClass || (FirstClass = NextClass); | ||
}; | ||
}; |
@@ -1,3 +0,2 @@ | ||
var ReactMount = require('react/lib/ReactMount'), | ||
deepForceUpdate = require('./deepForceUpdate'); | ||
var deepForceUpdate = require('./deepForceUpdate'); | ||
@@ -11,3 +10,3 @@ var isRequestPending = false; | ||
*/ | ||
function forceUpdateAll() { | ||
function forceUpdateAll(ReactMount) { | ||
isRequestPending = false; | ||
@@ -14,0 +13,0 @@ |
{ | ||
"name": "react-hot-api", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A generic library implementing hot reload for React components without unmounting or losing their state.", | ||
@@ -5,0 +5,0 @@ "main": "modules/index.js", |
@@ -18,3 +18,3 @@ react-hot-api | ||
#### `require('react-hot-api'): () => makeHot` | ||
#### `require('react-hot-api'): (ReactMount) => makeHot` | ||
@@ -24,2 +24,4 @@ Invoke this once within each hot-reloadable module to obtain the function described above. | ||
`ReactMount` corresponds to `react/lib/ReactMount` and needs to be passed by the caller. | ||
### Usage | ||
@@ -60,3 +62,3 @@ | ||
// On the first run, we will get here | ||
makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(); | ||
makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(require('react/lib/ReactMount')); | ||
} | ||
@@ -89,3 +91,3 @@ | ||
// On the second run, we will *NOT* get here | ||
makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(); | ||
makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(require('react/lib/ReactMount')); | ||
} | ||
@@ -105,3 +107,3 @@ | ||
// put the function into some sane place (e.g. module.makeHot) without relying on hidden variables | ||
module.makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(); | ||
module.makeHot = SOME_STORAGE_SHARED_BETWEEN_VERSIONS_OF_SAME_MODULE.makeHot = require('react-hot-api')(require('react/lib/ReactMount')); | ||
} | ||
@@ -108,0 +110,0 @@ // You might generate the code above with your build tool |
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
11523
139
141