Example #1
0
func (o *Object) SetInternalField(index int, value interface{}) {
	C.V8_Object_SetInternalField(
		o.self,
		C.int(index),
		unsafe.Pointer(&value),
	)
}
Example #2
0
func (o *Object) SetInternalField(index int, value interface{}) {
	C.V8_Object_SetInternalField(
		o.self,
		C.int(index),
		unsafe.Pointer(&value),
	)

	// the value reference by object so the value can't destory by GC
	o.internalFields = append(o.internalFields, value)
	o.setOwner(o)
}
Example #3
0
func (o *Object) SetInternalField(index int, value interface{}) {
	C.V8_Object_SetInternalField(
		o.self,
		C.int(index),
		unsafe.Pointer(&value),
	)

	// the value reference by object so the value can't destory by GC
	o.internalFields = append(o.internalFields, value)

	// the object reference by engine
	if o.fieldOwnerId == 0 {
		o.engine.fieldOwnerId += 1
		o.fieldOwnerId = o.engine.fieldOwnerId
		o.engine.fieldOwners[o.fieldOwnerId] = o
		C.V8_Object_SetFieldOwnerInfo(o.self, unsafe.Pointer(o.engine), C.int64_t(o.fieldOwnerId))
	}
}