Skip to content

Commit 3234d04

Browse files
committed
New API: feature.getInternals()
1 parent 460de3a commit 3234d04

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

api/feature.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class Feature {
8181
path: window.location.pathname,
8282
scratch: document.querySelector("#app") ? 3 : 2,
8383
}
84+
this.getInternals = function(element) {
85+
let reactKey = Object.keys(element).find((key) => key.startsWith("__reactInternalInstance"))
86+
if (!reactKey) return null;
87+
88+
return element[reactKey]
89+
}
8490
this.redux = document.querySelector("#app")?.[
8591
Object.keys(app).find((key) => key.startsWith("__reactContainer"))
8692
].child.stateNode.store

0 commit comments

Comments
 (0)