func NewEngine() *Engine { self := C.V8_NewEngine() if self == nil { return nil } result := &Engine{ self: self, funcTemplates: make(map[int]*FunctionTemplate), objectTemplates: make(map[int]*ObjectTemplate), } runtime.SetFinalizer(result, func(e *Engine) { if traceDispose { println("v8.Engine.Dispose()", e.self) } C.V8_DisposeEngine(e.self) }) return result }
func NewEngine() *Engine { self := C.V8_NewEngine() if self == nil { return nil } engine := &Engine{ self: self, funcTemplates: make(map[int64]*FunctionTemplate), objectTemplates: make(map[int64]*ObjectTemplate), fieldOwners: make(map[int64]interface{}), bindTypes: make(map[reflect.Type]*ObjectTemplate), } runtime.SetFinalizer(engine, func(e *Engine) { if traceDispose { println("v8.Engine.Dispose()", e.self) } C.V8_DisposeEngine(e.self) }) return engine }