Exemplo n.º 1
0
func (ctx *Context) newErrorOrPanic(message string) C.JSValueRef {
	obj, err := ctx.NewError(message)
	if err != nil {
		panic("newErrorOrPanic: " + err.Error())
	}

	// Any JSObjectRef can be safely cast to a JSValueRef.
	// https://lists.webkit.org/pipermail/webkit-dev/2009-May/007530.html
	return C.JSValueRef(obj.ref)
}
Exemplo n.º 2
0
func (ctx *Context) NewValueFrom(raw RawValue) *Value {
	return ctx.newValue(C.JSValueRef(raw))
}
Exemplo n.º 3
0
// ToValue returns the JSValueRef wrapper for the object.
//
// Any JSObjectRef can be safely cast to a JSValueRef.
// https://lists.webkit.org/pipermail/webkit-dev/2009-May/007530.html
func (obj *Object) ToValue() *Value {
	if obj == nil {
		panic("ToValue() called on nil *Object!")
	}
	return obj.ctx.newValue(C.JSValueRef(obj.ref))
}