Mercurial > pub > ImplabJs
diff src/implab/declare/override.js @ 34:27e8e9e38e07 default tip
Слияние
author | nickolay |
---|---|
date | Wed, 05 Jun 2019 20:44:15 +0300 |
parents | 8af8e840dd49 1dc2fd263b90 |
children |
line wrap: on
line diff
--- a/src/implab/declare/override.js Wed Jun 05 17:44:17 2019 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -"use strict"; -define([], function () { - var slice = Array.prototype.slice; - var override = function (method) { - var proxy; - - /** @this target object */ - proxy = function () { - var me = this; - var inherited = (this.getInherited && this.getInherited(proxy.nom, { - callee: proxy - })) || function () {}; - - return method.apply(me, [function () { - return inherited.apply(me, arguments); - }].concat(slice.apply(arguments))); - }; - - proxy.method = method; - proxy.overrides = true; - - return proxy; - }; - - override.before = 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, arguments); - return inherited.apply(me, arguments); - }; - - proxy.method = method; - proxy.overrides = true; - - return proxy; - }; - - override.after = function (method) { - var proxy; - - /** @this target object */ - proxy = function () { - var me = this; - var inherited = (this.getInherited && this.getInherited(proxy.nom, { - callee: proxy - })) || function () {}; - - inherited.apply(me, arguments); - - return method.apply(me, arguments); - }; - - proxy.method = method; - proxy.overrides = true; - - return proxy; - }; - - override.hide = function (method) { - method.overrides = false; - return method; - }; - - return override; -}); \ No newline at end of file