mail/src/js/app-config.js

58 lines
987 B
JavaScript
Raw Normal View History

2013-04-01 17:23:25 -04:00
(function() {
'use strict';
2013-03-13 11:58:46 -04:00
2013-04-01 17:23:25 -04:00
/**
* Create the application namespace
*/
2013-06-10 11:57:33 -04:00
var app = {
2013-04-01 17:23:25 -04:00
model: {},
view: {},
dao: {},
crypto: {},
util: {}
};
/**
* Global app configurations
*/
app.config = {
cloudUrl: 'http://storage.whiteout.io',
2013-04-01 17:23:25 -04:00
symKeySize: 128,
2013-05-31 19:45:38 -04:00
symIvSize: 128,
asymKeySize: 1024,
2013-04-01 17:23:25 -04:00
workerPath: 'js'
};
/**
* The Template Loader. Used to asynchronously load templates located in separate .html files
*/
app.util.tpl = {
templates: {},
get: function(name) {
return this.templates[name];
},
loadTemplates: function(names, callback) {
var that = this;
var loadTemplate = function(index) {
var name = names[index];
console.log('Loading template: ' + name);
$.get('tpl/' + name + '.html', function(data) {
that.templates[name] = data;
index++;
if (index < names.length) {
loadTemplate(index);
} else {
callback();
}
});
};
loadTemplate(0);
}
};
2013-06-10 11:57:33 -04:00
window.app = app;
2013-04-01 17:23:25 -04:00
}());