diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 7a4f335ad..ef5d892d8 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -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}