diff --git a/README.md b/README.md index 0273f1e1b..1a1ad0a0d 100644 --- a/README.md +++ b/README.md @@ -89,23 +89,23 @@ Things might work in Edge 18, Firefox 50-62 and Chrome 54-68 due to one polyfill |js/* |1.14.0 |native | |----------- |--------: |--------: | -|admin.js |2.130.942 | 941.273 | -|app.js |4.184.455 |2.533.271 | +|admin.js |2.130.942 | 935.611 | +|app.js |4.184.455 |2.517.449 | |boot.js | 671.522 | 5.777 | |libs.js | 647.614 | 327.257 | |polyfills.js | 325.834 | 0 | -|TOTAL |7.960.367 |3.807.578 | +|TOTAL |7.960.367 |3.786.094 | |js/min/* |1.14.0 |native |gzip 1.14 |gzip |brotli | |--------------- |--------: |--------: |--------: |--------: |--------: | -|admin.min.js | 252.147 | 128.671 | 73.657 | 37.600 | 32.254 | -|app.min.js | 511.202 | 346.350 |140.462 | 90.770 | 73.272 | +|admin.min.js | 252.147 | 128.146 | 73.657 | 37.448 | 32.137 | +|app.min.js | 511.202 | 344.299 |140.462 | 90.265 | 73.006 | |boot.min.js | 66.007 | 3.101 | 22.567 | 1.576 | 1.346 | |libs.min.js | 572.545 | 304.000 |176.720 | 94.870 | 83.524 | |polyfills.min.js | 32.452 | 0 | 11.312 | 0 | 0 | -|TOTAL |1.434.353 | 782.122 |424.718 |224.816 |190.396 | +|TOTAL |1.434.353 | 779.546 |424.718 |224.159 |190.013 | -652.231 bytes (199.902 gzip) is not much, but it feels faster. +654.807 bytes (200.559 gzip) is not much, but it feels faster. ### CSS changes diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 725c52f2f..3adf8dc7d 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -184,13 +184,6 @@ class MessageModel extends AbstractModel { ).filter((value, index, self) => !!value && self.indexOf(value) == index); } - /** - * @returns {Array} - */ - getRecipientsEmails() { - return this.getEmails(['to', 'cc']); - } - /** * @returns {string} */ diff --git a/dev/Remote/AbstractFetch.js b/dev/Remote/AbstractFetch.js index 85aecad1e..3962ca1bd 100644 --- a/dev/Remote/AbstractFetch.js +++ b/dev/Remote/AbstractFetch.js @@ -70,14 +70,19 @@ class AbstractFetchRemote } /** - * @param {?Function} fResultCallback - * @param {Object} oParameters - * @param {?number=} iTimeOut = 20000 + * @param {?Function} fCallback + * @param {string} sAction + * @param {Object=} oParameters + * @param {?number=} iTimeout * @param {string=} sGetAdd = '' * @param {Array=} aAbortActions = [] */ - ajaxRequest(fResultCallback, params, iTimeOut = 20000, sGetAdd = '', abortActions = []) { + defaultRequest(fCallback, sAction, params, iTimeout, sGetAdd, abortActions) { params = params || {}; + params.Action = sAction; + + sGetAdd = pString(sGetAdd); + const start = Date.now(), action = params.Action || ''; @@ -86,8 +91,8 @@ class AbstractFetchRemote } return rl.fetchJSON(getURL(sGetAdd), { - signal: this.createAbort(action, iTimeOut) - }, iTimeOut, sGetAdd ? null : params + signal: this.createAbort(action, undefined === iTimeout ? DEFAULT_AJAX_TIMEOUT : pInt(iTimeout)) + }, sGetAdd ? null : params ).then(data => { let cached = false; if (data) { @@ -117,8 +122,8 @@ class AbstractFetchRemote iAjaxErrorCount = iTokenErrorCount = 0; } - if (fResultCallback) { - fResultCallback( + if (fCallback) { + fCallback( sType, StorageResultType.Success === sType ? data : null, cached, @@ -154,27 +159,6 @@ class AbstractFetchRemote }); } - /** - * @param {?Function} fCallback - * @param {string} sAction - * @param {Object=} oParameters - * @param {?number=} iTimeout - * @param {string=} sGetAdd = '' - * @param {Array=} aAbortActions = [] - */ - defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions) { - oParameters = oParameters || {}; - oParameters.Action = sAction; - - return this.ajaxRequest( - fCallback, - oParameters, - undefined === iTimeout ? DEFAULT_AJAX_TIMEOUT : pInt(iTimeout), - pString(sGetAdd), - aAbortActions - ); - } - /** * @param {?Function} fCallback */ @@ -234,7 +218,7 @@ class AbstractFetchRemote return rl.fetchJSON(getURL(), { signal: this.createAbort(action, pInt(timeOut, DEFAULT_AJAX_TIMEOUT)) - }, pInt(timeOut, DEFAULT_AJAX_TIMEOUT), params + }, params ).then(data => { this.abort(action, true); diff --git a/dev/bootstrap.js b/dev/bootstrap.js index b36e9b811..dc9d23bca 100644 --- a/dev/bootstrap.js +++ b/dev/bootstrap.js @@ -53,7 +53,7 @@ export default (App) => { dropdownVisibility(!!rl.Dropdowns.find(item => item.classList.contains('open'))) ).debounce(50); - rl.fetchJSON = (resource, init, timeout, postData) => { + rl.fetchJSON = (resource, init, postData) => { init = Object.assign({ mode: 'same-origin', cache: 'no-cache', @@ -85,21 +85,6 @@ export default (App) => { } return fetch(resource, init).then(response => response.json()); -/* - let f = fetch(resource, init); - if (reviver) { - return f.then(response => response.text()) - .then(json => { - try { - return JSON.parse(json, reviver); - } catch (e) { - console.error(e); - throw e; - } - }); - } - return f.then(response => response.json()); -*/ }; window.__APP_BOOT = fErrorCallback => {