Beispiel #1
0
static JSBool
JsTestObject_value_set(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JSBool strict, JS::MutableHandleValue vp)
{
	JsTestObject *p = (JsTestObject *)JS_GetPrivate(obj);

	int32_t value;

	JS::ToInt32(cx, vp.get(), &value);

	p->SetValue(value);

	return JS_TRUE;
}
JSBool
getProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
{
  JSString *propName=JSID_TO_STRING(id);
  printf("in getProperty %s[%ld]=%s\n",JS_EncodeString(cx,propName),JSID_BITS(id.get()),JS_EncodeString(cx,JS_ValueToString(cx,vp.get())));
  return true;
}
JSBool
delProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
{
  printf("in delProperty %ld=%s\n",JSID_BITS(id.get()),JS_EncodeString(cx,JS_ValueToString(cx,vp.get())));
  return true;
}