Resources for Learning
TODO WeakMap and Weakset
Automatic Garbage collection of keys
Tricks
Find all property symbols
Object.getOwnPropertySymbols(object)
Get all objects in the entire javascript scope which have a specific function
(function deepThreeSearch() {
const visited = new WeakSet();
const found = [];
function scan(obj, path = "window") {
if (!obj || typeof obj !== "object" && typeof obj !== "function") return;
if (visited.has(obj)) return;
visited.add(obj);
// Check for applyMatrix4 directly on this object
if (obj.applyMatrix4 && typeof obj.applyMatrix4 === "function") {
console.log("🔥 FOUND applyMatrix4 AT:", path, obj);
found.push({ path, obj });
}
// Check prototype
const proto = Object.getPrototypeOf(obj);
if (proto && !visited.has(proto)) {
scan(proto, path + ".__proto__");
}
// Scan normal property keys
let keys;
try {
keys = Object.keys(obj);
} catch (_) {
keys = [];
}
for (const key of keys) {
try {
scan(obj[key], path + "." + key);
} catch (_) {}
}
// Scan symbol property keys
let syms;
try {
syms = Object.getOwnPropertySymbols(obj);
} catch (_) {
syms = [];
}
for (const sym of syms) {
try {
scan(obj[sym], path + "[" + sym.toString() + "]");
} catch (_) {}
}
}
console.log("⏳ Starting deep scan...");
scan(window);
console.log("✅ Scan complete. Found:", found);
return found;
})();