Created
July 24, 2019 17:04
-
-
Save yorickvP/ba7ebf5a84482d52506ff52c7bc50bae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = { | |
checkDCE: function() {}, | |
supportsFiber: true, | |
roots: new Set(), | |
inject() {}, | |
onCommitFiberRoot(rendererID, root) { | |
const current = root.current; | |
if (current.memoizedState != null && current.memoizedState.element != null) { | |
if (!this.roots.has(root)) { | |
this.roots.add(root); | |
console.log("got react!") | |
} | |
} else { | |
this.roots.delete(root) | |
} | |
}, | |
get state() { | |
return Array.from(this.roots)[0].current.memoizedState.element.props.store.getState() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment