rendered paste bodyMyObject = Class.create();MyObject.prototype = { initialize: function(key) { this.FooKey = {What: key }; }};AnotherObject = Class.create();AnotherObject.prototype = { initialize: function(key) { this.BarKey = {Who: key }; }};/* --- */var singletons = { MyObject: {prop: 'FooKey', key: 'What'} ,AnotherObject: {prop: 'BarKey', key: 'Who'}};// shared bound constructorfunction singletonInit(type, data) { this[type.prop] = {}; this[type.prop][type.key] = data;}for (var name in singletons) { window[name] = Class.create(); window[name].prototype.initialize = singletonInit.bind(singletons[name]);}