Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions classy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
* :copyright: (c) 2011 by Armin Ronacher.
* :license: BSD.
*/
!function (context) {
'use strict';
!function (definition) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
else this.Class = definition()
}(function (undefined) {
else context.Class = definition()
}(function (undefined) {
var
CLASSY_VERSION = '1.4',
context = this,
old = context.Class,
disable_constructor = false;

Expand Down Expand Up @@ -122,7 +123,7 @@
var rv = function() {
if (disable_constructor)
return;
var proper_this = context === this ? cheapNew(arguments.callee) : this;
var proper_this = this instanceof rv ? this : cheapNew(rv);
if (proper_this.__init__)
proper_this.__init__.apply(proper_this, arguments);
proper_this.$class = rv;
Expand Down Expand Up @@ -158,4 +159,5 @@

/* export the class */
return Class;
});
});
}(this);