Esempio n. 1
0
func (ctx *Context) NewStringValue(value string) *Value {
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	jsstr := C.JSStringCreateWithUTF8CString(cvalue)
	defer C.JSStringRelease(jsstr)
	ref := C.JSValueMakeString(ctx.ref, jsstr)
	return ctx.newValue(ref)
}
Esempio n. 2
0
func NewString(value string) *String {
	cvalue := C.CString(value)
	defer C.free(unsafe.Pointer(cvalue))
	ref := C.JSStringCreateWithUTF8CString(cvalue)
	return (*String)(unsafe.Pointer(ref))
}