mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
add nanoajax
This commit is contained in:
13
nanoajax/nanoajax-tests.ts
Normal file
13
nanoajax/nanoajax-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./nanoajax.d.ts" />
|
||||
|
||||
import * as nanoajax from 'nanoajax';
|
||||
|
||||
nanoajax.ajax({
|
||||
url: '/some-get-url'
|
||||
}, function (code, responseText) {})
|
||||
|
||||
nanoajax.ajax({
|
||||
url: '/some-post-url',
|
||||
method: 'POST',
|
||||
body: 'post=content&args=yaknow'
|
||||
}, function (code, responseText, request) {})
|
||||
20
nanoajax/nanoajax.d.ts
vendored
Normal file
20
nanoajax/nanoajax.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for nanoajax v0.2.4
|
||||
// Project: https://github.com/yanatan16/nanoajax
|
||||
// Definitions by: Nathan Cahill <https://github.com/nathancahill/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'nanoajax' {
|
||||
interface RequestParameters {
|
||||
url: string;
|
||||
headers?: { [key: string]: string; };
|
||||
body?: string|FormData;
|
||||
method?: string;
|
||||
cors?: boolean;
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
(statusCode: number, response: string, request: XMLHttpRequest): any
|
||||
}
|
||||
|
||||
export function ajax(params: RequestParameters, callback: Callback): XMLHttpRequest
|
||||
}
|
||||
Reference in New Issue
Block a user