Files
11cafe-comfyui-workspace-ma…/entry/entry.js
T
2024-01-12 19:34:08 +08:00

27 lines
733 B
JavaScript

const targetNode = document.body;
// Options for the observer (which mutations to observe)
const config = { childList: true, subtree: true };
// @ts-ignore
const callback = function (mutationsList, observer) {
for (const mutation of mutationsList) {
if (mutation.type === "childList") {
// @ts-ignore
mutation.addedNodes.forEach((node) => {
if (node.nodeName === "CANVAS") {
// @ts-ignore
import("/workspace_web/input.js");
observer.disconnect();
}
});
}
}
};
// Create an instance of the MutationObserver
const observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);