From 81c21d07ef202d33ec3f36090e3a5fcd992ee45f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 23 Nov 2019 09:34:11 +0100 Subject: [PATCH] - Code cleanup --- js/app/counter.js | 3 +-- js/app/{ => lib}/console.js | 0 js/app/lib/cron.js | 12 ++++++++---- js/app/notification.js | 11 +++++------ js/app/promises/promise.timeout.js | 2 -- js/app/util.js | 2 +- public/js/v1.5.5/app/counter.js | 3 +-- public/js/v1.5.5/app/{ => lib}/console.js | 0 public/js/v1.5.5/app/lib/cron.js | 12 ++++++++---- public/js/v1.5.5/app/notification.js | 11 +++++------ public/js/v1.5.5/app/promises/promise.timeout.js | 2 -- public/js/v1.5.5/app/util.js | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) rename js/app/{ => lib}/console.js (100%) rename public/js/v1.5.5/app/{ => lib}/console.js (100%) diff --git a/js/app/counter.js b/js/app/counter.js index 43d670b7..866c92c9 100644 --- a/js/app/counter.js +++ b/js/app/counter.js @@ -1,9 +1,8 @@ define([ 'jquery', - 'app/init', 'app/util', 'app/lib/cron' -], ($, Init, Util, Cron) => { +], ($, Util, Cron) => { 'use strict'; let config = { diff --git a/js/app/console.js b/js/app/lib/console.js similarity index 100% rename from js/app/console.js rename to js/app/lib/console.js diff --git a/js/app/lib/cron.js b/js/app/lib/cron.js index d60f6951..87086eed 100644 --- a/js/app/lib/cron.js +++ b/js/app/lib/cron.js @@ -68,14 +68,18 @@ define([ return this._name; } - get precision(){ - return this._config.precision; - } - get task(){ return this._task; } + get runCount(){ + return this._runCount; + } + + get precision(){ + return this._config.precision; + } + set task(task){ if(task instanceof Function){ this._task = task; diff --git a/js/app/notification.js b/js/app/notification.js index 71f7d59d..0279d28d 100644 --- a/js/app/notification.js +++ b/js/app/notification.js @@ -8,8 +8,7 @@ define([ 'pnotify.desktop', //'pnotify.history', 'pnotify.callbacks' -], function($, Init, PNotify){ - +], ($, Init, PNotify) => { 'use strict'; let config = { @@ -76,7 +75,7 @@ define([ * @param customConfig * @param settings */ - let showNotify = function(customConfig, settings){ + let showNotify = (customConfig, settings) => { customConfig = $.extend(true, {}, config, customConfig ); // desktop notification @@ -149,7 +148,7 @@ define([ * change document.title and make the browsers tab blink * @param blinkTitle */ - let startTabBlink = function(blinkTitle){ + let startTabBlink = blinkTitle => { let initBlink = (function(blinkTitle){ // count blinks if tab is currently active @@ -174,7 +173,7 @@ define([ blinkTimer = setInterval(blink, 1000); } }; - }( blinkTitle )); + }(blinkTitle)); initBlink(); }; @@ -182,7 +181,7 @@ define([ /** * stop blinking document.title */ - let stopTabBlink = function(){ + let stopTabBlink = () => { if(blinkTimer){ clearInterval(blinkTimer); document.title = initialPageTitle; diff --git a/js/app/promises/promise.timeout.js b/js/app/promises/promise.timeout.js index 4c7c8b71..bef06497 100644 --- a/js/app/promises/promise.timeout.js +++ b/js/app/promises/promise.timeout.js @@ -43,7 +43,6 @@ define([], () => { constructor(callback, timeout = 6000){ let timer; let promise = callback[Symbol.toStringTag] === 'Promise' ? callback : new Promise(callback); - //let promise = new Promise(callback); let wrapperPromise = Promise.race([ promise, @@ -63,7 +62,6 @@ define([], () => { reject(error); }); }); - } }; }); \ No newline at end of file diff --git a/js/app/util.js b/js/app/util.js index 9df3fef2..5eac759b 100644 --- a/js/app/util.js +++ b/js/app/util.js @@ -4,7 +4,7 @@ define([ 'jquery', 'app/init', - 'app/console', + 'app/lib/console', 'conf/system_effect', 'conf/signature_type', 'bootbox', diff --git a/public/js/v1.5.5/app/counter.js b/public/js/v1.5.5/app/counter.js index 43d670b7..866c92c9 100644 --- a/public/js/v1.5.5/app/counter.js +++ b/public/js/v1.5.5/app/counter.js @@ -1,9 +1,8 @@ define([ 'jquery', - 'app/init', 'app/util', 'app/lib/cron' -], ($, Init, Util, Cron) => { +], ($, Util, Cron) => { 'use strict'; let config = { diff --git a/public/js/v1.5.5/app/console.js b/public/js/v1.5.5/app/lib/console.js similarity index 100% rename from public/js/v1.5.5/app/console.js rename to public/js/v1.5.5/app/lib/console.js diff --git a/public/js/v1.5.5/app/lib/cron.js b/public/js/v1.5.5/app/lib/cron.js index d60f6951..87086eed 100644 --- a/public/js/v1.5.5/app/lib/cron.js +++ b/public/js/v1.5.5/app/lib/cron.js @@ -68,14 +68,18 @@ define([ return this._name; } - get precision(){ - return this._config.precision; - } - get task(){ return this._task; } + get runCount(){ + return this._runCount; + } + + get precision(){ + return this._config.precision; + } + set task(task){ if(task instanceof Function){ this._task = task; diff --git a/public/js/v1.5.5/app/notification.js b/public/js/v1.5.5/app/notification.js index 71f7d59d..0279d28d 100644 --- a/public/js/v1.5.5/app/notification.js +++ b/public/js/v1.5.5/app/notification.js @@ -8,8 +8,7 @@ define([ 'pnotify.desktop', //'pnotify.history', 'pnotify.callbacks' -], function($, Init, PNotify){ - +], ($, Init, PNotify) => { 'use strict'; let config = { @@ -76,7 +75,7 @@ define([ * @param customConfig * @param settings */ - let showNotify = function(customConfig, settings){ + let showNotify = (customConfig, settings) => { customConfig = $.extend(true, {}, config, customConfig ); // desktop notification @@ -149,7 +148,7 @@ define([ * change document.title and make the browsers tab blink * @param blinkTitle */ - let startTabBlink = function(blinkTitle){ + let startTabBlink = blinkTitle => { let initBlink = (function(blinkTitle){ // count blinks if tab is currently active @@ -174,7 +173,7 @@ define([ blinkTimer = setInterval(blink, 1000); } }; - }( blinkTitle )); + }(blinkTitle)); initBlink(); }; @@ -182,7 +181,7 @@ define([ /** * stop blinking document.title */ - let stopTabBlink = function(){ + let stopTabBlink = () => { if(blinkTimer){ clearInterval(blinkTimer); document.title = initialPageTitle; diff --git a/public/js/v1.5.5/app/promises/promise.timeout.js b/public/js/v1.5.5/app/promises/promise.timeout.js index 4c7c8b71..bef06497 100644 --- a/public/js/v1.5.5/app/promises/promise.timeout.js +++ b/public/js/v1.5.5/app/promises/promise.timeout.js @@ -43,7 +43,6 @@ define([], () => { constructor(callback, timeout = 6000){ let timer; let promise = callback[Symbol.toStringTag] === 'Promise' ? callback : new Promise(callback); - //let promise = new Promise(callback); let wrapperPromise = Promise.race([ promise, @@ -63,7 +62,6 @@ define([], () => { reject(error); }); }); - } }; }); \ No newline at end of file diff --git a/public/js/v1.5.5/app/util.js b/public/js/v1.5.5/app/util.js index 9df3fef2..5eac759b 100644 --- a/public/js/v1.5.5/app/util.js +++ b/public/js/v1.5.5/app/util.js @@ -4,7 +4,7 @@ define([ 'jquery', 'app/init', - 'app/console', + 'app/lib/console', 'conf/system_effect', 'conf/signature_type', 'bootbox',