Skip to content

Instantly share code, notes, and snippets.

@dkraczkowski
Created August 5, 2014 22:10
Show Gist options
  • Save dkraczkowski/08d26a5ec1e49022ed72 to your computer and use it in GitHub Desktop.
Save dkraczkowski/08d26a5ec1e49022ed72 to your computer and use it in GitHub Desktop.
Class
/**
*
* Copyright (C) 2011 by crac <![[dawid.kraczkowski[at]gmail[dot]com]]>
* Thanks for Hardy Keppler<![[Keppler.H[at]online.de]]> for shortened version
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
**/
var Class=function(){function t(t,n){for(var r in n){if(r==="extend"||r==="static"||r==="isA"||r==="mixin"){continue}if(typeof n[r]==="object"){continue}if(e&&r===r.toUpperCase()){Object.defineProperty(t,r,{writable:false,configurable:false,enumerable:true,value:n[r]})}else{t[r]=n[r]}}}var e=typeof Object.defineProperty==="function";return function(e){var n=false;return function r(e,i){var s=function(){if(typeof this["create"]==="function"&&n===false){this.create.apply(this,arguments)}};if(e!==null){n=true;s.prototype=new e;n=false;t(s,e)}var o=s.prototype;if(typeof o.isA==="undefined"){o.isA=function(e){if(this instanceof e){return true}else if(typeof o.__mixins!=="undefined"&&o.__mixins.indexOf(e)>=0){return true}return false}}for(var u in i){o[u]=i[u]}s.extend=function(e){return r(this,e)};s.static=function(e){t(s,e);return s};s.mixin=function(){for(var e=0,t=arguments.length;e<t;e++){var n=arguments[e];var r=n.prototype;for(var i in r){var u=i==="create"||i==="isA";if(r.hasOwnProperty(i)&&typeof r[i]==="function"&&!u){o[i]=r[i]}}o.__mixins=o.__mixins||[];o.__mixins.push(n)}return s};return s}(null,e)}}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment