Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
78
gaia/apps/email/js/ext/maildb.js
Executable file
78
gaia/apps/email/js/ext/maildb.js
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
*
|
||||
**/
|
||||
|
||||
define(
|
||||
[
|
||||
'./worker-router',
|
||||
'exports'
|
||||
],
|
||||
function(
|
||||
$router,
|
||||
exports
|
||||
) {
|
||||
'use strict';
|
||||
|
||||
var sendMessage = $router.registerCallbackType('maildb');
|
||||
|
||||
function MailDB(testOptions) {
|
||||
this._callbacksQueue = [];
|
||||
function processQueue() {
|
||||
console.log('main thread reports DB ready');
|
||||
this._ready = true;
|
||||
|
||||
this._callbacksQueue.forEach(function executeCallback(cb) {
|
||||
cb();
|
||||
});
|
||||
this._callbacksQueue = null;
|
||||
}
|
||||
|
||||
sendMessage('open', [testOptions], processQueue.bind(this));
|
||||
}
|
||||
exports.MailDB = MailDB;
|
||||
MailDB.prototype = {
|
||||
close: function() {
|
||||
sendMessage('close');
|
||||
},
|
||||
|
||||
getConfig: function(callback) {
|
||||
if (!this._ready) {
|
||||
console.log('deferring getConfig call until ready');
|
||||
this._callbacksQueue.push(this.getConfig.bind(this, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('issuing getConfig call to main thread');
|
||||
sendMessage('getConfig', null, callback);
|
||||
},
|
||||
|
||||
saveConfig: function(config) {
|
||||
sendMessage('saveConfig', [config]);
|
||||
},
|
||||
|
||||
saveAccountDef: function(config, accountDef, folderInfo, callback) {
|
||||
sendMessage('saveAccountDef', [ config, accountDef, folderInfo ], callback);
|
||||
},
|
||||
|
||||
loadHeaderBlock: function(folderId, blockId, callback) {
|
||||
sendMessage('loadHeaderBlock', [ folderId, blockId], callback);
|
||||
},
|
||||
|
||||
loadBodyBlock: function(folderId, blockId, callback) {
|
||||
sendMessage('loadBodyBlock', [ folderId, blockId], callback);
|
||||
},
|
||||
|
||||
saveAccountFolderStates: function(accountId, folderInfo, perFolderStuff,
|
||||
deletedFolderIds, callback, reuseTrans) {
|
||||
var args = [ accountId, folderInfo, perFolderStuff, deletedFolderIds ];
|
||||
sendMessage('saveAccountFolderStates', args, callback);
|
||||
// XXX vn Does this deserve any purpose?
|
||||
return null;
|
||||
},
|
||||
|
||||
deleteAccount: function(accountId) {
|
||||
sendMessage('deleteAccount', [accountId]);
|
||||
},
|
||||
};
|
||||
|
||||
}); // end define
|
||||
Loading…
Reference in a new issue