mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 05:29:20 +03:00
Added isFunction()
This commit is contained in:
parent
658ac816c8
commit
fe4dbc729c
6 changed files with 13 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { isArray, addObservablesTo, addComputablesTo } from 'Common/Utils';
|
||||
import { isArray, isFunction, addObservablesTo, addComputablesTo } from 'Common/Utils';
|
||||
|
||||
function dispose(disposable) {
|
||||
if (disposable && 'function' === typeof disposable.dispose) {
|
||||
if (disposable && isFunction(disposable.dispose)) {
|
||||
disposable.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { doc, $htmlCL } from 'Common/Globals';
|
||||
import { isNonEmptyArray } from 'Common/Utils';
|
||||
import { isNonEmptyArray, isFunction } from 'Common/Utils';
|
||||
|
||||
let currentScreen = null,
|
||||
defaultScreenName = '';
|
||||
|
|
@ -39,7 +39,7 @@ export function createCommand(fExecute, fCanExecute = true) {
|
|||
fResult.enabled = ko.observable(true);
|
||||
fResult.isCommand = true;
|
||||
|
||||
if (typeof fCanExecute === 'function') {
|
||||
if (isFunction(fCanExecute)) {
|
||||
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && fCanExecute.call(null));
|
||||
} else {
|
||||
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && !!fCanExecute);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue