Exemple #1
0
func (a *Array) SetElement(index int, v *Value) bool {
	var result bool
	a.cx.rt.Use(func() {
		result = C.JS_SetElement(a.cx.jscx, a.obj, C.jsint(index), &v.val) == C.JS_TRUE
	})
	return result
}
Exemple #2
0
func (a *Array) GetElement(index int) *Value {
	var result *Value
	a.cx.rt.Use(func() {
		var rval C.jsval
		if C.JS_GetElement(a.cx.jscx, a.obj, C.jsint(index), &rval) == C.JS_TRUE {
			result = newValue(a.cx, rval)
		}
	})
	return result
}