============================================================================= RUNTIME-SCOPED CONSTRUCTOR REGISTRY FOR UNIFIED MAPPING ============================================================================= Helper function to create a stable key from JSValue For constructor functions, we use th
(jsVal C.JSValue)
| 17 | // Helper function to create a stable key from JSValue |
| 18 | // For constructor functions, we use the object pointer as a unique identifier |
| 19 | func jsValueToKey(jsVal C.JSValue) uint64 { |
| 20 | // Constructors are JavaScript objects, so we use the object pointer |
| 21 | // This is stable and unique for each JavaScript object instance |
| 22 | objPtr := C.JS_VALUE_GET_PTR_Wrapper(jsVal) |
| 23 | return uint64(uintptr(objPtr)) |
| 24 | } |
| 25 | |
| 26 | // registerConstructorClassID stores the constructor -> classID mapping |
| 27 | func registerConstructorClassID(ctx *Context, constructor C.JSValue, classID uint32) { |
no outgoing calls