This commit is contained in:
cdle
2023-06-28 13:35:04 +08:00
parent 3bdbb07ba3
commit bae0e14898
24 changed files with 354 additions and 322 deletions
+1 -17
View File
@@ -112,24 +112,8 @@ func CancelPluginCrons(uuid string) {
func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func() bool) {
vm.Set("Bucket", func(name string) interface{} {
return vm.NewProxy(MakeBucketObject(vm, uuid, on_start, MakeBucket(name)), &goja.ProxyTrapConfig{
Get: func(target *goja.Object, property string, receiver goja.Value) (value goja.Value) {
obj := target.Get(property)
if obj != nil {
return obj
}
result := target.Get("get").Export().(func(...interface{}) interface{})(property)
return vm.ToValue(result)
},
Set: func(target *goja.Object, property string, value, receiver goja.Value) (success bool) {
result := target.Get("set").Export().(func(interface{}, interface{}) error)(
property, value.Export(),
)
return result == nil
},
})
return JsBucket(vm, name, uuid, on_start)
})
sillyplusJsIplm := func(call goja.ConstructorCall) *goja.Object {
userId := fmt.Sprintf("%d", rand.Int63())
call.This.Set("isSlaveMode", func() bool {