Пример #1
0
// Auto generate "Motto" module let can run in Javascript VM
func GenerateScriptModule(prefix string, name string, script string) string {
	name = prefix + "_" + name
	motto.AddModule(name, func(vm *motto.Motto) (otto.Value, error) {
		return motto.CreateLoaderFromSource(script, "")(vm)
	})
	return name
}
Пример #2
0
func underscore(vm *motto.Motto) (otto.Value, error) {
	return motto.CreateLoaderFromSource(source(), "")(vm)
}