mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Sound notification
Additional code refactoring
This commit is contained in:
parent
b42ce01e7e
commit
aa84077ac4
87 changed files with 1573 additions and 574 deletions
43
dev/Stores/User/Quota.js
Normal file
43
dev/Stores/User/Quota.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
ko = require('ko')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function QuotaUserStore()
|
||||
{
|
||||
this.quota = ko.observable(0);
|
||||
this.usage = ko.observable(0);
|
||||
|
||||
this.percentage = ko.computed(function () {
|
||||
|
||||
var
|
||||
iQuota = this.quota(),
|
||||
iUsed = this.usage()
|
||||
;
|
||||
|
||||
return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} iQuota
|
||||
* @param {number} iUsage
|
||||
*/
|
||||
QuotaUserStore.prototype.populateData = function(iQuota, iUsage)
|
||||
{
|
||||
this.quota(iQuota * 1024);
|
||||
this.usage(iUsage * 1024);
|
||||
};
|
||||
|
||||
module.exports = new QuotaUserStore();
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue