diff src/implab/declare/override.js @ 0:fc2517695ee1

Initial commit, draft import of existing work
author cin
date Thu, 01 Jun 2017 13:20:03 +0300
parents
children 3d124d0b9078
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/implab/declare/override.js	Thu Jun 01 13:20:03 2017 +0300
@@ -0,0 +1,24 @@
+"use strict";
+define([], function () {
+    var slice = Array.prototype.slice;
+    return function (method) {
+        var proxy;
+
+        /** @this target object */
+        proxy = function () {
+            var me = this;
+            var inherited = (this.getInherited && this.getInherited(proxy.nom, {
+                callee: proxy
+            })) || function () {};
+
+            method.apply(me, [function () {
+                return inherited.apply(me, arguments);
+            }].concat(slice.apply(arguments)));
+        };
+
+        proxy.method = method;
+        proxy.overrides = true;
+
+        return proxy;
+    };
+});
\ No newline at end of file