mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Remove jquery.ajaxfile. (#16762)
This commit is contained in:
committed by
Mohamed Hegazy
parent
eaa830ba77
commit
460b77b169
@@ -222,6 +222,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/is-upper-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "jquery.ajaxfile",
|
||||
"typingsPackageName": "jquery.ajaxfile",
|
||||
"sourceRepoURL": "https://github.com/fpellet/jquery.ajaxFile",
|
||||
"asOfVersion": "0.2.29"
|
||||
},
|
||||
{
|
||||
"libraryName": "JSNLog",
|
||||
"typingsPackageName": "jsnlog",
|
||||
|
||||
Vendored
-116
@@ -1,116 +0,0 @@
|
||||
// Type definitions for jquery.ajaxfile v0.2.0
|
||||
// Project: https://github.com/fpellet/jquery.ajaxFile
|
||||
// Definitions by: Florent PELLET <https://github.com/fpellet/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="knockout" />
|
||||
|
||||
declare namespace JQueryAjaxFile {
|
||||
export enum DataType {
|
||||
Json,
|
||||
Xml,
|
||||
Text
|
||||
}
|
||||
|
||||
interface IFileData {
|
||||
name: string;
|
||||
element: HTMLInputElement;
|
||||
}
|
||||
|
||||
interface IOption {
|
||||
method?: string;
|
||||
url?: string;
|
||||
|
||||
data?: any;
|
||||
files?: IFileData[];
|
||||
desiredResponseDataType?: DataType;
|
||||
|
||||
timeoutInSeconds?: number;
|
||||
}
|
||||
|
||||
interface IResponseStatus {
|
||||
code: number;
|
||||
text: string;
|
||||
isSuccess: boolean;
|
||||
}
|
||||
|
||||
interface IAjaxFileResult<T> {
|
||||
error?: any;
|
||||
data?: any;
|
||||
status?: IResponseStatus;
|
||||
}
|
||||
|
||||
interface IAjaxFileResultCallback<T> {
|
||||
(result: IAjaxFileResult<T>): void;
|
||||
}
|
||||
|
||||
interface IAjaxFilePromise<T> {
|
||||
then(success: IAjaxFileResultCallback<T>, error?: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
done(success: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
fail(error: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
always(error: IAjaxFileResultCallback<T>): IAjaxFilePromise<T>;
|
||||
|
||||
abord(): void;
|
||||
}
|
||||
|
||||
interface IAjaxFileStatic {
|
||||
DataType: typeof DataType;
|
||||
send<T>(option: IOption): IAjaxFilePromise<T>;
|
||||
}
|
||||
|
||||
interface IJQueryXHR {
|
||||
readyState: any;
|
||||
status: number;
|
||||
statusText: string;
|
||||
responseXML: Document;
|
||||
responseText: string;
|
||||
statusCode?: { [key: string]: any; };
|
||||
|
||||
abort(statusText?: string): void;
|
||||
|
||||
setRequestHeader(header: string, value: string): void;
|
||||
getAllResponseHeaders(): string;
|
||||
getResponseHeader(header: string): string;
|
||||
|
||||
beforeSend?(jqXHR: IJQueryXHR, settings: JQueryAjaxSettings): any;
|
||||
dataFilter?(data: any, ty: any): any;
|
||||
success?(data: any, textStatus: string, jqXHR: IJQueryXHR): any;
|
||||
error?(jqXHR: IJQueryXHR, textStatus: string, errorThrown: string): any;
|
||||
complete?(jqXHR: IJQueryXHR, textStatus: string): any;
|
||||
}
|
||||
|
||||
interface IJQueryOption {
|
||||
type?: string;
|
||||
url?: string;
|
||||
|
||||
data?: any;
|
||||
files?: IFileData[];
|
||||
dataType?: string;
|
||||
|
||||
timeout?: number;
|
||||
|
||||
global?: boolean;
|
||||
|
||||
error?(jqXHR: IJQueryXHR, textStatus: string, errorThrown: string): any;
|
||||
success?(data: any, textStatus: string, jqXHR: IJQueryXHR): any;
|
||||
complete?(jqXHR: IJQueryXHR, textStatus: string): any;
|
||||
}
|
||||
|
||||
interface IAjaxFileJQueryExtension {
|
||||
ajaxWithFile<T>(jqueryOption: IJQueryOption): JQueryDeferred<T>;
|
||||
}
|
||||
}
|
||||
|
||||
declare var AjaxFile: JQueryAjaxFile.IAjaxFileStatic;
|
||||
|
||||
declare namespace AjaxFileKnockout {
|
||||
interface IFileInputWrapper {
|
||||
getElement(): HTMLInputElement;
|
||||
fileSelected(): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
interface KnockoutBindingHandlers {
|
||||
file: KnockoutBindingHandler;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
function testRawApi(){
|
||||
var inputElement:HTMLInputElement = null;
|
||||
var resultPromise = AjaxFile.send<number>({
|
||||
method: 'POST',
|
||||
url: '/',
|
||||
desiredResponseDataType: JQueryAjaxFile.DataType.Json,
|
||||
files: [
|
||||
{ name: 'joeFile', element: inputElement }
|
||||
],
|
||||
data: {
|
||||
name: 'joe'
|
||||
},
|
||||
timeoutInSeconds: 30
|
||||
})
|
||||
.then(result => console.log('Result: ' + result.data), result => console.log('Error: ' + result.error))
|
||||
.done(result => console.log('Result: ' + result.data))
|
||||
.fail(result => console.log('Error: ' + result.error + " " + result.status.code + " " + result.status.text + " " + result.status.isSuccess))
|
||||
.always(result => console.log('end'))
|
||||
.abord();
|
||||
}
|
||||
|
||||
function testJQuery() {
|
||||
var inputElement: HTMLInputElement = null;
|
||||
var extension: JQueryAjaxFile.IAjaxFileJQueryExtension = $.fn.ajaxWithFile;
|
||||
var option: JQueryAjaxFile.IJQueryOption = {
|
||||
type: 'POST',
|
||||
url: '/',
|
||||
dataType: "json",
|
||||
files: [
|
||||
{ name: 'joeFile', element: inputElement }
|
||||
],
|
||||
data: {
|
||||
name: 'joe'
|
||||
},
|
||||
success(result) { console.log('Result: ' + result); },
|
||||
error(jqXhr, textStatus, errorThrown) { console.log('Error: ' + errorThrown); },
|
||||
complete(jqXhr, textStatus) { console.log('end'); },
|
||||
global: true,
|
||||
timeout: 60
|
||||
};
|
||||
extension.ajaxWithFile<number>(option);
|
||||
}
|
||||
|
||||
function testKnockoutExtension(){
|
||||
var fileHandler:KnockoutBindingHandler = ko.bindingHandlers.file;
|
||||
}
|
||||
|
||||
testKnockoutExtension();
|
||||
testJQuery();
|
||||
testRawApi();
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"jquery.ajaxfile-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user