mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 19:02:20 -05:00
add documentation
This commit is contained in:
parent
93ddfb1c99
commit
cd93e8866f
@ -7,17 +7,29 @@ define(function(require) {
|
|||||||
InvitationDAO = require('js/dao/invitation-dao'),
|
InvitationDAO = require('js/dao/invitation-dao'),
|
||||||
dbType = 'email_OUTBOX';
|
dbType = 'email_OUTBOX';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* High level business object that orchestrates the local outbox.
|
||||||
|
* The local outbox takes care of the emails before they are being sent.
|
||||||
|
* It also checks periodically if there are any mails in the local device storage to be sent.
|
||||||
|
*/
|
||||||
var OutboxBO = function(emailDao, invitationDao) {
|
var OutboxBO = function(emailDao, invitationDao) {
|
||||||
this._emailDao = emailDao;
|
this._emailDao = emailDao;
|
||||||
this._invitationDao = invitationDao;
|
this._invitationDao = invitationDao;
|
||||||
this._outboxBusy = false;
|
this._outboxBusy = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function activates the periodic checking of the local device storage for pending mails.
|
||||||
|
* @param {Function} callback(error, pendingMailsCount) Callback that informs you about the count of pending mails.
|
||||||
|
*/
|
||||||
OutboxBO.prototype.startChecking = function(callback) {
|
OutboxBO.prototype.startChecking = function(callback) {
|
||||||
// start periodic checking of outbox
|
// start periodic checking of outbox
|
||||||
this._intervalId = setInterval(this._processOutbox.bind(this, callback), config.checkOutboxInterval);
|
this._intervalId = setInterval(this._processOutbox.bind(this, callback), config.checkOutboxInterval);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Outbox stops the periodic checking of the local device storage for pending mails.
|
||||||
|
*/
|
||||||
OutboxBO.prototype.stopChecking = function() {
|
OutboxBO.prototype.stopChecking = function() {
|
||||||
if (!this._intervalId) {
|
if (!this._intervalId) {
|
||||||
return;
|
return;
|
||||||
@ -27,6 +39,10 @@ define(function(require) {
|
|||||||
delete this._intervalId;
|
delete this._intervalId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the local device storage for pending mails.
|
||||||
|
* @param {Function} callback(error, pendingMailsCount) Callback that informs you about the count of pending mails.
|
||||||
|
*/
|
||||||
OutboxBO.prototype._processOutbox = function(callback) {
|
OutboxBO.prototype._processOutbox = function(callback) {
|
||||||
var self = this,
|
var self = this,
|
||||||
emails;
|
emails;
|
||||||
|
Loading…
Reference in New Issue
Block a user