src/js/oop.js
function() {
        var methods   = arguments[arguments.length - 1],
            hasMethod = Array.isArray(methods);

        // inject class
        if (hasMethod && this.$isExtended !== true) {
            // create intermediate class
            var A = this.$parent !== null ? Class(this.$parent, [])
                                          : Class([]);

            // copy this class prototypes methods to intermediate class A and re-define
            // boundTo to the intermediate class A if they were bound to source class
            // methods that have been  moved from source class to class have to be re-bound
            // to A class
            for(var name in this.prototype) {
                if (name !== "clazz" && this.prototype.hasOwnProperty(name) ) {
                    var f = this.prototype[name];
                    if (typeof f === 'function') {
                        A.prototype[name] = f.methodBody !== undefined ? $ProxyMethod(name, f.methodBody, f.boundTo)
                                                                       : f;

                        if (A.prototype[name].boundTo === this) {
                            A.prototype[name].boundTo = A;
                            if (f.boundTo === this) {
                                f.boundTo = A;
                            }
                        }
                    }
                }
            }

            this.$parent = A;
            this.$isExtended = true;
        }

        if (hasMethod) {
            $mixing(this, methods);
        }

        // add passed interfaces
        for(var i = 0; i < arguments.length - (hasMethod ? 1 : 0); i++) {
            var I = arguments[i];
            if (I === null || I === undefined || I.clazz !== Interface) {
                throw new Error("Interface is expected");
            }

            if (this.$parents[I.$hash$] !== undefined) {
                throw new Error("Interface has been already inherited");
            }

            $cpMethods(I.prototype, this.prototype, this);
            this.$parents[I.$hash$] = I;
        }

        return this;
    }
function() {
        var methods   = arguments[arguments.length - 1],
            hasMethod = Array.isArray(methods);

        // inject class
        if (hasMethod && this.$isExtended !== true) {
            // create intermediate class
            var A = this.$parent !== null ? Class(this.$parent, [])
                                          : Class([]);

            // copy this class prototypes methods to intermediate class A and re-define
            // boundTo to the intermediate class A if they were bound to source class
            // methods that have been  moved from source class to class have to be re-bound
            // to A class
            for(var name in this.prototype) {
                if (name !== "clazz" && this.prototype.hasOwnProperty(name) ) {
                    var f = this.prototype[name];
                    if (typeof f === 'function') {
                        A.prototype[name] = f.methodBody !== undefined ? $ProxyMethod(name, f.methodBody, f.boundTo)
                                                                       : f;

                        if (A.prototype[name].boundTo === this) {
                            A.prototype[name].boundTo = A;
                            if (f.boundTo === this) {
                                f.boundTo = A;
                            }
                        }
                    }
                }
            }

            this.$parent = A;
            this.$isExtended = true;
        }

        if (hasMethod) {
            $mixing(this, methods);
        }

        // add passed interfaces
        for(var i = 0; i < arguments.length - (hasMethod ? 1 : 0); i++) {
            var I = arguments[i];
            if (I === null || I === undefined || I.clazz !== Interface) {
                throw new Error("Interface is expected");
            }

            if (this.$parents[I.$hash$] !== undefined) {
                throw new Error("Interface has been already inherited");
            }

            $cpMethods(I.prototype, this.prototype, this);
            this.$parents[I.$hash$] = I;
        }

        return this;
    }
function ( ) { var methods = arguments [ arguments . length - 1 ] , hasMethod = Array . isArray ( methods ) ; // inject class if ( hasMethod && this . $isExtended !== true ) { // create intermediate class var A = this . $parent !== null ? Class ( this . $parent , [ ] ) : Class ( [ ] ) ; // copy this class prototypes methods to intermediate class A and re-define // boundTo to the intermediate class A if they were bound to source class // methods that have been  moved from source class to class have to be re-bound // to A class for ( var name in this . prototype ) { if ( name !== "clazz" && this . prototype . hasOwnProperty ( name ) ) { var f = this . prototype [ name ] ; if ( typeof f === 'function' ) { A . prototype [ name ] = f . methodBody !== undefined ? $ProxyMethod ( name , f . methodBody , f . boundTo ) : f ; if ( A . prototype [ name ] . boundTo === this ) { A . prototype [ name ] . boundTo = A ; if ( f . boundTo === this ) { f . boundTo = A ; } } } } } this . $parent = A ; this . $isExtended = true ; } if ( hasMethod ) { $mixing ( this , methods ) ; } // add passed interfaces for ( var i = 0 ; i < arguments . length - ( hasMethod ? 1 : 0 ) ; i ++ ) { var I = arguments [ i ] ; if ( I === null || I === undefined || I . clazz !== Interface ) { throw new Error ( "Interface is expected" ) ; } if ( this . $parents [ I . $hash$ ] !== undefined ) { throw new Error ( "Interface has been already inherited" ) ; } $cpMethods ( I . prototype , this . prototype , this ) ; this . $parents [ I . $hash$ ] = I ; } return this ; }
Extend the class with new method and implemented interfaces.
@param {zebkit.Interface} [interfaces]*  number of interfaces the class has to implement.
@param {Array} methods set of methods the given class has to be extended.
@method extend
@chainable
@for zebkit.Class
 add extend method later to avoid the method be inherited as a class static field
Extend the class with new method and implemented interfaces .