MCPcopy Create free account
hub / github.com/buke/quickjs-go / jsValueToKey

Function jsValueToKey

class.go:19–24  ·  view source on GitHub ↗

============================================================================= 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)

Source from the content-addressed store, hash-verified

17// Helper function to create a stable key from JSValue
18// For constructor functions, we use the object pointer as a unique identifier
19func 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
27func registerConstructorClassID(ctx *Context, constructor C.JSValue, classID uint32) {

Calls

no outgoing calls