mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
Removed createCommandLegacy
This commit is contained in:
parent
b8043cdc98
commit
e4ddef97d6
1 changed files with 0 additions and 30 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { dropdownVisibility, data as GlobalsData } from 'Common/Globals';
|
||||
import { ComposeType, SaveSettingsStep, FolderType } from 'Common/Enums';
|
||||
import { Mime } from 'Common/Mime';
|
||||
|
|
@ -248,34 +246,6 @@ export function friendlySize(sizeInBytes) {
|
|||
return sizeInBytes + 'B';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {(Object|null|undefined)} context
|
||||
* @param {Function} fExecute
|
||||
* @param {(Function|boolean|null)=} fCanExecute = true
|
||||
* @returns {Function}
|
||||
*/
|
||||
export function createCommandLegacy(context, fExecute, fCanExecute = true) {
|
||||
let fResult = null;
|
||||
const fNonEmpty = (...args) => {
|
||||
if (fResult && fResult.canExecute && fResult.canExecute()) {
|
||||
fExecute.apply(context, args);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
fResult = fExecute ? fNonEmpty : ()=>{};
|
||||
fResult.enabled = ko.observable(true);
|
||||
fResult.isCommand = true;
|
||||
|
||||
if (typeof fCanExecute === 'function') {
|
||||
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && fCanExecute.call(context));
|
||||
} else {
|
||||
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && !!fCanExecute);
|
||||
}
|
||||
|
||||
return fResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} theme
|
||||
* @returns {string}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue