Add mkws.objectWithParent function -- not yet used.
authorMike Taylor <mike@indexdata.com>
Fri, 28 Mar 2014 10:48:22 +0000 (10:48 +0000)
committerMike Taylor <mike@indexdata.com>
Fri, 28 Mar 2014 10:48:22 +0000 (10:48 +0000)
src/mkws-core.js

index ba20871..893951c 100644 (file)
@@ -102,6 +102,16 @@ mkws.log = function(string) {
 };
 
 
+mkws.objectWithParent = function(parent) {
+    function thing() {} // Must be function so `prototype' works
+
+    thing.prototype = parent;
+    var res = new thing();
+    thing.prototype = null;
+    return res;
+};
+
+
 mkws.registerWidgetType = function(name, fn) {
     mkws.widgetType2function[name] = fn;
     mkws.log("registered widget-type '" + name + "'");