split constructor function and place of instanciation for app.js objects: app[appname] = new app.classes[appname]();

This commit is contained in:
Ralf Becker
2013-11-04 20:54:23 +00:00
parent f41480a3f6
commit 6d226a7921
11 changed files with 178 additions and 160 deletions

View File

@@ -214,7 +214,13 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
// Initialize application js
var app_callback = null;
// Only initialize once
if(typeof app[appname] == "function")
// new app class with constructor function in app.classes[appname]
if (typeof app[appname] !== 'object' && typeof app.classes[appname] == 'function')
{
app[appname] = new app.classes[appname]();
}
// old app class with constructor function in app[appname] (deprecated)
else if(typeof app[appname] == "function")
{
(function() { new app[appname]();}).call();
}