diff options
author | Chad Austin <chad@imvu.com> | 2014-05-16 23:34:47 -0700 |
---|---|---|
committer | Chad Austin <chad@chadaustin.me> | 2014-05-16 23:41:36 -0700 |
commit | b41adadcf60a25c14f4b139d0ee664521f76a620 (patch) | |
tree | bfa375fa57f071b4eb0aeb49d1630fa41171b80e /tests/embind/embind_test.cpp | |
parent | 398cded47b7e08fbb753fb7b4788da29a22195bb (diff) |
expose typeof via emscripten::val
Diffstat (limited to 'tests/embind/embind_test.cpp')
-rw-r--r-- | tests/embind/embind_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp index 5a83903a..52103bbb 100644 --- a/tests/embind/embind_test.cpp +++ b/tests/embind/embind_test.cpp @@ -2368,3 +2368,11 @@ EMSCRIPTEN_BINDINGS(val_new_) { function("construct_with_memory_view", &construct_with_memory_view); function("construct_with_ints_and_float", &construct_with_ints_and_float); } + +std::string getTypeOfVal(const val& v) { + return v.typeof().as<std::string>(); +} + +EMSCRIPTEN_BINDINGS(typeof) { + function("getTypeOfVal", &getTypeOfVal); +} |