1) add a method to run global javascript function on val 2) fix a bug to

return val from interface wrapper
This commit is contained in:
jinsuck 2012-11-16 11:35:59 -08:00 коммит произвёл Jukka Jylänki
Родитель 778b8eb983
Коммит 0d745fa116
2 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {
}
};
}
}