aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2014-05-02 14:56:45 -0700
committerBruce Mitchener <bruce.mitchener@gmail.com>2014-05-21 22:55:45 +0700
commita30b438d002a389a523350e2bb0f66b0cf92711d (patch)
treef3f41012eca9acb1cfa32584e3609381b8c38799 /src
parenta2487b69b6d5e0fc81ef67f062f61764fad5af00 (diff)
properties set in constructor persist to methods
Diffstat (limited to 'src')
-rw-r--r--src/embind/embind.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index fe784001..8947c76f 100644
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -1730,17 +1730,24 @@ function __embind_register_class_class_function(
});
}
-function __embind_create_inheriting_constructor(constructorName, wrapperType) {
+function __embind_create_inheriting_constructor(constructorName, wrapperType, properties) {
constructorName = readLatin1String(constructorName);
wrapperType = requireRegisteredType(wrapperType, 'wrapper');
+ properties = requireHandle(properties);
+
var registeredClass = wrapperType.registeredClass;
var wrapperPrototype = registeredClass.instancePrototype;
var baseConstructor = registeredClass.baseClass.constructor;
var ctor = createNamedFunction(constructorName, function() {
var inner = baseConstructor.implement(this);
this.$$ = inner.$$;
+ this.initialize.apply(this, Array.prototype.slice.call(arguments));
});
ctor.prototype = Object.create(wrapperPrototype);
+ ctor.prototype.initialize = function initialize() {};
+ for (var p in properties) {
+ ctor.prototype[p] = properties[p];
+ }
return __emval_register(ctor);
}