mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Code refactoring (v2)
This commit is contained in:
parent
90d95d3ca4
commit
80ab02363e
29 changed files with 858 additions and 857 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import {$, _, key} from 'common';
|
||||
import ko from 'ko';
|
||||
import {EventKeyCode} from 'Common/Enums';
|
||||
import {isArray, inArray} from 'Common/Utils';
|
||||
import {isArray, inArray, noop, noopTrue} from 'Common/Utils';
|
||||
|
||||
class Selector
|
||||
{
|
||||
|
|
@ -118,9 +118,6 @@ class Selector
|
|||
this.sLastUid = '';
|
||||
this.oCallbacks = {};
|
||||
|
||||
this.emptyFunction = () => {};
|
||||
this.emptyTrueFunction = () => true;
|
||||
|
||||
this.focusedItem.subscribe((item) => {
|
||||
if (item)
|
||||
{
|
||||
|
|
@ -291,14 +288,14 @@ class Selector
|
|||
{
|
||||
if (!item)
|
||||
{
|
||||
(this.oCallbacks.onItemSelect || this.emptyFunction)(item || null);
|
||||
(this.oCallbacks.onItemSelect || noop)(item || null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item)
|
||||
{
|
||||
(this.oCallbacks.onItemSelect || this.emptyFunction)(item);
|
||||
(this.oCallbacks.onItemSelect || noop)(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -416,14 +413,14 @@ class Selector
|
|||
* @return {boolean}
|
||||
*/
|
||||
autoSelect() {
|
||||
return !!(this.oCallbacks.onAutoSelect || this.emptyTrueFunction)();
|
||||
return !!(this.oCallbacks.onAutoSelect || noopTrue)();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} up
|
||||
*/
|
||||
doUpUpOrDownDown(up) {
|
||||
(this.oCallbacks.onUpUpOrDownDown || this.emptyTrueFunction)(!!up);
|
||||
(this.oCallbacks.onUpUpOrDownDown || noopTrue)(!!up);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue