aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2014-05-12 11:26:54 -0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-05-21 23:05:41 +0700
commit91edf0395130e3c7a31318b9d546f0ca415c6274 (patch)
tree5ea6935032737ea413aeb3a305dd7030673c447b
parent22288a4229ccba67a4cf0cbe4730ddde9589f0f3 (diff)
minor refactoring: I intend to bring back wrapper.implement
-rw-r--r--system/include/emscripten/bind.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index f6debae1..b2c83fc9 100644
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -895,6 +895,12 @@ namespace emscripten {
, wrapped(std::forward<val>(wrapped))
{}
+ ~wrapper() {
+ if (notifyJSOnDestruction) {
+ call<void>("__destruct");
+ }
+ }
+
template<typename ReturnType, typename... Args>
ReturnType call(const char* name, Args&&... args) const {
return wrapped.call<ReturnType>(name, std::forward<Args>(args)...);
@@ -909,18 +915,20 @@ namespace emscripten {
}
}
+ void setNotifyJSOnDestruction(bool notify) {
+ notifyJSOnDestruction = notify;
+ }
+
private:
val wrapped;
+ bool notifyJSOnDestruction = true;
};
#define EMSCRIPTEN_WRAPPER(T) \
template<typename... Args> \
T(::emscripten::val&& v, Args&&... args) \
: wrapper(std::forward<::emscripten::val>(v), std::forward<Args>(args)...) \
- {} \
- ~T() { \
- call<void>("__destruct"); \
- }
+ {}
namespace internal {
struct NoBaseClass {