mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Remove qajax (#15175)
This commit is contained in:
Vendored
-26
@@ -1,26 +0,0 @@
|
||||
// Type definitions for Qajax
|
||||
// Project: https://github.com/gre/qajax
|
||||
// Definitions by: Boltmade <https://github.com/Boltmade>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as Q from "q";
|
||||
|
||||
export = Qajax;
|
||||
export as namespace Qajax;
|
||||
|
||||
declare function Qajax(url : string) : Q.Promise<XMLHttpRequest>;
|
||||
declare function Qajax(options : any) : Q.Promise<XMLHttpRequest>;
|
||||
declare function Qajax(url : string, options : any) : Q.Promise<XMLHttpRequest>;
|
||||
|
||||
declare namespace Qajax {
|
||||
export var defaults : any;
|
||||
export function filterStatus(validStatus : number) : (xhr : XMLHttpRequest) => Q.Promise<XMLHttpRequest>;
|
||||
export function filterStatus(validStatus : (status : number) => boolean) : (xhr : XMLHttpRequest) => Q.Promise<XMLHttpRequest>;
|
||||
export function filterSuccess() : Q.Promise<XMLHttpRequest>;
|
||||
|
||||
export function toJSON(xhr : XMLHttpRequest) : Q.Promise<any>;
|
||||
|
||||
export function getJSON(url : string) : Q.Promise<any>;
|
||||
|
||||
export function serialize(paramsObj : any) : string;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import Qajax = require("qajax");
|
||||
import * as Q from 'q';
|
||||
|
||||
// Based on https://github.com/gre/qajax/blob/master/test/qajax.js
|
||||
|
||||
function resetDefaults () {
|
||||
Qajax.defaults.logs = true;
|
||||
Qajax.defaults.timeout = 1000;
|
||||
Qajax.defaults.method = "GET";
|
||||
Qajax.defaults.headers = {};
|
||||
Qajax.defaults.base = "";
|
||||
}
|
||||
|
||||
var sample01url = "/test/dataset/sample01.json";
|
||||
var sample01json = [
|
||||
{ "name": "Jerome", "age": 20 },
|
||||
{ "name": "Gerard", "age": 30 },
|
||||
{ "name": "Martine", "age": 43 }
|
||||
];
|
||||
|
||||
var emptyUrl = "/test/dataset/empty";
|
||||
|
||||
function urlWithOptions (url : string, options : any) {
|
||||
return url+"?"+Qajax.serialize(options);
|
||||
}
|
||||
|
||||
Qajax;
|
||||
Qajax.filterStatus;
|
||||
Qajax.filterSuccess;
|
||||
Qajax.getJSON;
|
||||
Qajax.serialize({ foo: 123, bar: "toto" });
|
||||
Qajax.getJSON(sample01url).then((res) => true, (err) => true);
|
||||
Qajax(sample01url).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax(emptyUrl, { params: { status: 404 } }).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax({method: "POST", url: "/ECHO", data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n"}).then(Qajax.filterSuccess);
|
||||
Qajax({method: "POST", url: "/ECHO", data: { foo: 123, bar: { value: 42 }, arr: [1, 2, 3] }}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax({ url: emptyUrl, params: { status: 201 } }).then(Qajax.filterStatus(200));
|
||||
Qajax({method: "POST", url: emptyUrl, params: { status: 500 }}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
|
||||
var cancellationD = Q.defer();
|
||||
var cancellation = cancellationD.promise;
|
||||
Qajax({ cancellation: cancellation, url: urlWithOptions(emptyUrl, { latency: 400 }) }).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
|
||||
Qajax.defaults.timeout = 200;
|
||||
Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }});
|
||||
|
||||
resetDefaults();
|
||||
Qajax({method: "POST", url: sample01url, params: { latency: 300 }, timeout: 2000});
|
||||
|
||||
Qajax.defaults.timeout = 200;
|
||||
Qajax({method: "DELETE", url: sample01url, params: { latency: 500 }, timeout: 0});
|
||||
|
||||
resetDefaults();
|
||||
Qajax({headers: { "X-Hello": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax({headers: { "X-Hi": "world" }, method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax.defaults.headers = {"X-Foo": "bar"};
|
||||
Qajax({method: "GET", url: "/ECHO_HEADERS"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
|
||||
resetDefaults();
|
||||
Qajax("sample01.json", {base: "/test/dataset/"}).then(Qajax.filterSuccess).then(Qajax.toJSON);
|
||||
Qajax.defaults.base = "/test/dataset/";
|
||||
Qajax("empty").then(Qajax.filterSuccess);
|
||||
|
||||
resetDefaults();
|
||||
Qajax.defaults.method = "POST";
|
||||
Qajax("/ECHO", { data: "1234567890\nazerty\nuiopqsdfghjklm\nwxcvbn\n", responseType: "text/plain" }).then(Qajax.filterSuccess);
|
||||
|
||||
resetDefaults();
|
||||
Qajax.getJSON(urlWithOptions(sample01url, { latency: 50 })).then((res) => true, (err) => true, () => true);
|
||||
@@ -1,26 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"q": [ "q/v0" ]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"qajax-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user