Example #1
0
func (e *Engine) NewFunction(callback FunctionCallback, data interface{}) *Function {
	function := new(Function)
	function.data = data
	function.callback = callback

	function.Object = newValue(e, C.V8_NewFunction(
		e.self, unsafe.Pointer(&function.callback), unsafe.Pointer(&function.data),
	)).ToObject()

	function.setOwner(function)

	return function
}
Example #2
0
//FUNCTION
func (engine_ *Engine) NewFunction(callback FunctionCallback, data interface{}) *Function {
	fun_ := new(Function)
	fun_.data = data
	fun_.callback = callback

	fun_.Value = NewValue(engine_, C.V8_NewFunction(
		engine_.self, unsafe.Pointer(&fun_.callback), unsafe.Pointer(&fun_.data),
	))

	//TODO alive object
	//function.setOwner(function)
	return fun_
}