mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 10:50:08 +00:00
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
|
|
/**********************************************************************
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*
|
||
|
|
**********************************************************************/
|
||
|
|
|
||
|
|
define(function(require){ var module = {}
|
||
|
|
console.log('>>> objects')
|
||
|
|
|
||
|
|
//var DEBUG = DEBUG != null ? DEBUG : true
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/*********************************************************************/
|
||
|
|
|
||
|
|
|
||
|
|
var makeConstructor =
|
||
|
|
module.makeConstructor =
|
||
|
|
function makeConstructor(name, a, b){
|
||
|
|
var proto = b == null ? a : b
|
||
|
|
var cls_proto = b == null ? b : a
|
||
|
|
|
||
|
|
var _constructor = function Constructor(json){
|
||
|
|
// in case this is called as a function (without new)...
|
||
|
|
if(this.constructor !== _constructor){
|
||
|
|
return new _constructor(json)
|
||
|
|
}
|
||
|
|
|
||
|
|
// load initial state...
|
||
|
|
if(json != null){
|
||
|
|
this.loadJSON(json)
|
||
|
|
} else {
|
||
|
|
this._reset()
|
||
|
|
}
|
||
|
|
|
||
|
|
return this
|
||
|
|
}
|
||
|
|
|
||
|
|
eval('_constructor = '+ _constructor.toString().replace(/Constructor/g, name))
|
||
|
|
|
||
|
|
_constructor.__proto__ = cls_proto
|
||
|
|
_constructor.prototype = proto
|
||
|
|
_constructor.prototype.constructor = _constructor
|
||
|
|
|
||
|
|
return _constructor
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**********************************************************************
|
||
|
|
* vim:set ts=4 sw=4 : */
|
||
|
|
return module })
|