Merge pull request #2281 from jlerasmus/Kolite-AsyncCommand-IsExecuting

Kolite - Added KoliteAsyncCommand interface (makes "isExecuting" public)
This commit is contained in:
John Reilly
2014-06-04 16:17:16 +01:00
2 changed files with 21 additions and 1 deletions
+16
View File
@@ -30,6 +30,22 @@ function test_asyncCommand() {
});
}
function test_asyncCommand_isExecuting() {
var primaryCommand = ko.asyncCommand({
execute: (complete) => {
$.when().always(complete);
},
canExecute: (isExecuting) => {
return !isExecuting;
}
});
var firstRun = true;
var canCancel = ko.computed(() => {
return firstRun && !primaryCommand.isExecuting();
});
}
function test_dirtyFlag() {
var viewModel;
viewModel.dirtyFlag = new ko.DirtyFlag(viewModel.model);
+5 -1
View File
@@ -58,6 +58,10 @@ interface KoliteCommand {
execute(...args: any[]): any;
}
interface KoliteAsyncCommand extends KoliteCommand {
isExecuting: KnockoutObservable<boolean>;
}
interface KoLiteCommandOptions {
execute?: any;
canExecute?: (isExecuting: boolean) => any;
@@ -65,7 +69,7 @@ interface KoLiteCommandOptions {
interface KnockoutStatic {
command(options: KoLiteCommandOptions): KoliteCommand;
asyncCommand(optons: KoLiteCommandOptions): KoliteCommand;
asyncCommand(optons: KoLiteCommandOptions): KoliteAsyncCommand;
}
interface KnockoutUtils {