Bugfix: canExecute not a function

Bugfix: _scopes.all is undefined
This commit is contained in:
djmaze 2021-02-19 19:39:04 +01:00
parent bc64fe6d0d
commit f673344408
2 changed files with 4 additions and 2 deletions

View file

@ -324,7 +324,7 @@ function decorateKoCommands(thisArg, commands) {
Object.entries(commands).forEach(([key, canExecute]) => {
let command = thisArg[key],
fn = function(...args) {
if (fn.enabled() && canExecute.call(thisArg, thisArg)) {
if (fn.enabled() && fn.canExecute()) {
command.apply(thisArg, args);
}
return false;

View file

@ -4,7 +4,9 @@
const
doc = document,
meta = /Mac OS X/.test(navigator.userAgent) ? 'meta' : 'ctrl',
_scopes = {},
_scopes = {
all: {}
},
toArray = v => Array.isArray(v) ? v : v.split(/\s*,\s*/),
keydown = event => {