[IMP] add ability to return a different object (than 'this') from Class.init, for factory-type scenarios
bzr revid: xmo@openerp.com-20110517095923-8lr1pjelf94nwu44
This commit is contained in:
@@ -44,8 +44,11 @@
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if ( !initializing && this.init )
|
||||
this.init.apply(this, arguments);
|
||||
if ( !initializing && this.init ) {
|
||||
var ret = this.init.apply(this, arguments);
|
||||
if (ret) { return ret; }
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
|
||||
Reference in New Issue
Block a user