Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#6349 from conficient/master
Browse files Browse the repository at this point in the history
ko.plus - fixed .fail method signature on command type
  • Loading branch information
vvakame committed Oct 21, 2015
2 parents 5cdad8b + 04a57f0 commit d46ea2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions ko.plus/ko.plus-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
Version 1.1 - added test for makeEditable
Version 1.2 - amended callback on commmand.fail() method - accepts response,
status and message values
Note: Typescript version 1.4 or higher is required for union types
and type declarations
*/
Expand All @@ -29,8 +32,13 @@ function CommandTests() {
.done((data: any) => {
alert("success");
})
.fail((error: string) => {
alert(error);
.fail((response) => {
// dummy
return false;
})
.fail((response, status, message) => {
// fail has response, error and text
alert(status + message);
});

// initialize command with options (action only)
Expand Down
8 changes: 6 additions & 2 deletions ko.plus/ko.plus.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Type definitions for ko.plus v0.0.21
// Type definitions for ko.plus v0.0.24
// Project: https://github.com/stevegreatrex/ko.plus
// Definitions by: Howard Richards <https://github.com/conficient>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../knockout/knockout.d.ts" />

/**
Expand All @@ -16,6 +17,9 @@
*
* Version 1.1 - fixed bug - makeEditable is now a function on .editable
* also refactored how the Editable classes inherit to simplify
*
* Version 1.2 - amended callback on commmand.fail() method - accepts response,
* status and message values
*/

//
Expand Down Expand Up @@ -87,7 +91,7 @@ declare module KoPlus {
//
done: (callback: (data: any) => void) => Command;

fail: (callback: (error: string) => void) => Command;
fail: (callback: (response: any, status?: string, statusText?:string) => void) => Command;

always: (callback: Function) => Command;

Expand Down

0 comments on commit d46ea2f

Please sign in to comment.