export goFunctionProxy
(ctx *C.JSContext, thisVal C.JSValueConst, argc C.int, argv *C.JSValueConst, magic C.int)
| 50 | |
| 51 | //export goFunctionProxy |
| 52 | func goFunctionProxy(ctx *C.JSContext, thisVal C.JSValueConst, |
| 53 | argc C.int, argv *C.JSValueConst, magic C.int) C.JSValue { |
| 54 | |
| 55 | goCtx, fn, err := getContextAndObject(ctx, magic, errFunctionNotFound) |
| 56 | if err != nil { |
| 57 | return throwProxyError(ctx, *err) |
| 58 | } |
| 59 | |
| 60 | goFn, ok := fn.(func(*Context, *Value, []*Value) *Value) |
| 61 | if !ok { |
| 62 | return throwProxyError(ctx, errInvalidFunctionType) |
| 63 | } |
| 64 | |
| 65 | args := convertCArgsToGoValues(argc, argv, goCtx) |
| 66 | thisValue := &Value{ctx: goCtx, ref: C.JSValue(thisVal)} |
| 67 | result := goFn(goCtx, thisValue, args) |
| 68 | if result == nil { |
| 69 | return C.JS_NewUndefined() |
| 70 | } |
| 71 | return result.ref |
| 72 | } |
| 73 | |
| 74 | //export goClassMethodProxy |
| 75 | func goClassMethodProxy(ctx *C.JSContext, thisVal C.JSValueConst, |
no test coverage detected