From cd93e8866f5c849cc928d232295cafe546092243 Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Thu, 21 Nov 2013 10:57:22 +0100 Subject: [PATCH] add documentation --- src/js/bo/outbox.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/js/bo/outbox.js b/src/js/bo/outbox.js index 4a76d5b..f23e4fe 100644 --- a/src/js/bo/outbox.js +++ b/src/js/bo/outbox.js @@ -7,17 +7,29 @@ define(function(require) { InvitationDAO = require('js/dao/invitation-dao'), 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) { this._emailDao = emailDao; this._invitationDao = invitationDao; 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) { // start periodic checking of outbox 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() { if (!this._intervalId) { return; @@ -27,6 +39,10 @@ define(function(require) { 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) { var self = this, emails;