aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/embind/emval.js7
-rw-r--r--system/include/emscripten/val.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/embind/emval.js b/src/embind/emval.js
index 6552b0a7..f74c0fd5 100644
--- a/src/embind/emval.js
+++ b/src/embind/emval.js
@@ -66,6 +66,13 @@ function __emval_get_property_by_unsigned_long(handle, k) {
return __emval_register(_emval_handle_array[handle].value[k]);
}
+function __emval_eval_global_method(handle, objectName, methodName) {
+ var objectNameStr = Pointer_stringify(objectName);
+ var methodNameStr = Pointer_stringify(methodName);
+ var result = eval.call(null, objectNameStr)[methodNameStr](_emval_handle_array[handle].value);
+ return __emval_register(result);
+}
+
function __emval_set_property(handle, k, value) {
k = Pointer_stringify(k);
_emval_handle_array[handle].value[k] = _emval_handle_array[value].value;
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h
index e3e57901..68f5b63e 100644
--- a/system/include/emscripten/val.h
+++ b/system/include/emscripten/val.h
@@ -17,6 +17,7 @@ namespace emscripten {
EM_VAL _emval_get_property(EM_VAL object, const char* key);
EM_VAL _emval_get_property_by_long(EM_VAL object, long key);
EM_VAL _emval_get_property_by_unsigned_long(EM_VAL object, unsigned long key);
+ EM_VAL _emval_eval_global_method(EM_VAL object, const char* objectName, const char* methodName);
void _emval_set_property(EM_VAL object, const char* key, EM_VAL value);
void _emval_set_property_by_int(EM_VAL object, long key, EM_VAL value);
void _emval_as(EM_VAL value, TYPEID returnType);
@@ -98,6 +99,10 @@ namespace emscripten {
return val(internal::_emval_get_property_by_unsigned_long(handle, key));
}
+ val eval_global_method(const char* objectName, const char* methodName) {
+ return val(internal::_emval_eval_global_method(handle, objectName, methodName));
+ }
+
void set(const char* key, val v) {
internal::_emval_set_property(handle, key, v.handle);
}
@@ -204,6 +209,8 @@ namespace emscripten {
static val fromWireType(WireType v) {
return val::take_ownership(v);
}
+ static void destroy(WireType v) {
+ }
};
}
}