func main() { if len(os.Args) != 2 { usage() } vm := motto.New() vm.Set("fib", func(call otto.FunctionCall) otto.Value { ret := fib(40) v, _ := otto.ToValue(ret) return v }) vm.Set("XHR", func(call otto.FunctionCall) otto.Value { return otto.UndefinedValue() }) vm.Set("XHR.prototype.hello", func(call otto.FunctionCall) otto.Value { return otto.UndefinedValue() }) _, err := vm.Run(os.Args[1]) fmt.Printf("%v", err) }
func (self *engine) Init(g scaffolt.Generator) error { engine := motto.New() self.engine = engine go engine.RunLoop.Run() return nil }