feat: add shadowroot injector

This commit is contained in:
Gabe
2025-10-28 00:07:44 +08:00
parent 66d39da80a
commit 9d8f3f4211
15 changed files with 129 additions and 275 deletions

View File

@@ -0,0 +1,12 @@
export const shadowRootInjector = () => {
try {
const orig = Element.prototype.attachShadow;
Element.prototype.attachShadow = function (...args) {
const root = orig.apply(this, args);
window.postMessage({ type: "KISS_SHADOW_ROOT_CREATED" }, "*");
return root;
};
} catch (err) {
console.log("shadowRootInjector", err);
}
};