diff options
-rwxr-xr-x | src/embind/emval.js | 4 | ||||
-rw-r--r-- | system/include/emscripten/val.h | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/embind/emval.js b/src/embind/emval.js index 56c307bf..39f23a61 100755 --- a/src/embind/emval.js +++ b/src/embind/emval.js @@ -67,6 +67,10 @@ function __emval_take_value(type, v) { return __emval_register(v); } +function __emval_new(handle) { + return __emval_register(new (_emval_handle_array[handle].value)) +} + var global = (function(){return Function;})()('return this')(); function __emval_get_global(name) { diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index 3d0a3e60..22a7776a 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -19,6 +19,8 @@ namespace emscripten { EM_VAL _emval_new_cstring(const char*); void _emval_take_value(TYPEID type/*, ...*/); + EM_VAL _emval_new(EM_VAL value); + EM_VAL _emval_get_global(const char* name); EM_VAL _emval_get_property(EM_VAL object, EM_VAL key); void _emval_set_property(EM_VAL object, EM_VAL key, EM_VAL value); @@ -102,6 +104,10 @@ namespace emscripten { bool hasOwnProperty(const char* key) const { return val::global("Object")["prototype"]["hasOwnProperty"].call("call", *this, val(key)).as<bool>(); } + + val new_() const { + return val(internal::_emval_new(handle)); + } template<typename T> val operator[](const T& key) const { |