Is there an ObjectSpace in JavaScript?
Say I have these "classes" defined in isolated closures like this:
(function() {
var Model;
Model = (function() {
function Model() {}
return Model;
})();
}).call(this);
(function() {
var View;
View = (function() {
function View() {}
return View;
})();
}).call(this);
(function() {
var Controller;
Controller = (function() {
function Controller() {}
return Controller;
})();
}).call(this);
Is there any way to look up all of those custom classes in JavaScript? Something like:
Object.classes;
Even if they were all in the same scope, is it possible?
var Model;
Model = (function() {
function Model() {}
return Model;
})();
var View;
View = (function() {
function View() {}
return View;
})();
Or would I just need to register them manually? Maybe like:
var ObjectSpace = {};
ObjectSpace.classes = [Model, View, Controller];
Just playing around with JavaScript/CoffeeScript and ideas from Ruby.