diff --git a/ui (gen4)/data.js b/ui (gen4)/data.js index 4a786b91..6bca2ea7 100755 --- a/ui (gen4)/data.js +++ b/ui (gen4)/data.js @@ -12,6 +12,8 @@ define(function(require){ var module = {} console.log('>>> data') +var object = require('object') + var formats = require('formats') var sha1 = require('./ext-lib/sha1') @@ -1805,6 +1807,7 @@ module.DataPrototype = { // Main Data object... // +/* var Data = module.Data = function Data(json){ @@ -1825,7 +1828,10 @@ function Data(json){ Data.__proto__ = DataClassPrototype Data.prototype = DataPrototype Data.prototype.constructor = Data +*/ +var Data = +module.Data = object.makeConstructor('Data', DataClassPrototype, DataPrototype) /********************************************************************** diff --git a/ui (gen4)/object.js b/ui (gen4)/object.js new file mode 100755 index 00000000..ea35abfd --- /dev/null +++ b/ui (gen4)/object.js @@ -0,0 +1,52 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +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 }) diff --git a/ui (gen4)/tags.js b/ui (gen4)/tags.js new file mode 100755 index 00000000..ba2f2ab6 --- /dev/null +++ b/ui (gen4)/tags.js @@ -0,0 +1,39 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +define(function(require){ var module = {} +console.log('>>> tags') + +//var DEBUG = DEBUG != null ? DEBUG : true + +var object = require('object') + + + +/*********************************************************************/ + +var TagsClassPrototype = {} + + +var TagsPrototype = { + loadJSON: function(json){ + }, + dumpJSON: function(){ + }, + + _reset: function(){ + }, +} + + +var Tags = +module.Tags = object.makeConstructor('Tags', TagsClassPrototype, TagsPrototype) + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ +return module })