Implementing API for associating native handle (uintptr_t) values with JS objects.

This commit is contained in:
Ruben Ayrapetyan
2015-04-06 15:38:26 +03:00
parent fc2dbf3b0b
commit 469ef4e622
9 changed files with 115 additions and 22 deletions
+7
View File
@@ -125,6 +125,8 @@ handler_construct (const jerry_api_object_t *function_obj_p,
jerry_api_set_object_field_value (this_p->v_object, "value_field", &args_p [0]);
jerry_api_set_object_native_handle (this_p->v_object, (uintptr_t) 0x0012345678abcdefull);
return true;
} /* handler_construct */
@@ -322,6 +324,11 @@ main (void)
&& val_value_field.v_bool == true);
jerry_api_release_value (&val_value_field);
uintptr_t ptr;
is_ok = jerry_api_get_object_native_handle (res.v_object, &ptr);
assert (is_ok
&& ptr == (uintptr_t) 0x0012345678abcdefull);
jerry_api_release_value (&res);
jerry_cleanup ();