mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #2281 from jlerasmus/Kolite-AsyncCommand-IsExecuting
Kolite - Added KoliteAsyncCommand interface (makes "isExecuting" public)
This commit is contained in:
@@ -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);
|
||||
|
||||
Vendored
+5
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user