Skip to content

Commit

Permalink
New API: feature.getInternals()
Browse files Browse the repository at this point in the history
  • Loading branch information
rgantzos committed Nov 30, 2024
1 parent 460de3a commit 3234d04
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ class Feature {
path: window.location.pathname,
scratch: document.querySelector("#app") ? 3 : 2,
}
this.getInternals = function(element) {
let reactKey = Object.keys(element).find((key) => key.startsWith("__reactInternalInstance"))
if (!reactKey) return null;

return element[reactKey]
}
this.redux = document.querySelector("#app")?.[
Object.keys(app).find((key) => key.startsWith("__reactContainer"))
].child.stateNode.store
Expand Down

0 comments on commit 3234d04

Please sign in to comment.