mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
Merge pull request #5757 from ryan10132/add-flowjs
added definitely typed files and tests for flowjs and ngflow
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
/// <reference path="flowjs.d.ts" />
|
||||
|
||||
// flow object
|
||||
var flowObject: flowjs.IFlow;
|
||||
var bool: boolean = flowObject.support;
|
||||
bool = flowObject.supportDirectory;
|
||||
var obj: Object = flowObject.opts;
|
||||
var flowFileArray: flowjs.IFlowFile[] = flowObject.files;
|
||||
|
||||
flowObject.assignBrowse(<HTMLElement[]> [], false, false, {});
|
||||
flowObject.assignDrop(<HTMLElement[]> []);
|
||||
flowObject.unAssignDrop(<HTMLElement[]> []);
|
||||
flowObject.on("", () => {});
|
||||
flowObject.off("", () => {});
|
||||
flowObject.upload();
|
||||
flowObject.pause();
|
||||
flowObject.resume();
|
||||
flowObject.cancel();
|
||||
flowObject.progress();
|
||||
bool = flowObject.isUploading();
|
||||
flowObject.addFile(<File> {});
|
||||
flowObject.removeFile(<flowjs.IFlowFile> {});
|
||||
var flowFile: flowjs.IFlowFile = flowObject.getFromUniqueIdentifier("");
|
||||
var num: number = flowObject.getSize();
|
||||
num = flowObject.sizeUploaded();
|
||||
num = flowObject.timeRemaining();
|
||||
|
||||
// flow options
|
||||
var flowOptions: flowjs.IFlowOptions = {};
|
||||
flowOptions.target = "";
|
||||
flowOptions.singleFile = true;
|
||||
flowOptions.chunkSize= 0;
|
||||
flowOptions.forceChunkSize = true;
|
||||
flowOptions.simultaneousUploads= 0;
|
||||
flowOptions.fileParameterName = "";
|
||||
flowOptions.query = {};
|
||||
flowOptions.headers = {};
|
||||
flowOptions.withCredentials = true;
|
||||
flowOptions.method = "";
|
||||
flowOptions.testMethod = "";
|
||||
flowOptions.uploadMethod = "";
|
||||
flowOptions.allowDuplicateUploads = true;
|
||||
flowOptions.prioritizeFirstAndLastChunk = true;
|
||||
flowOptions.testchunks = true;
|
||||
flowOptions.preprocess = () => {};
|
||||
flowOptions.initFileFn = () => {};
|
||||
flowOptions.generateUniqueIdentifier = () => {};
|
||||
flowOptions.maxChunkRetries= 0;
|
||||
flowOptions.chunkRetryInterval= 0;
|
||||
flowOptions.progressCallbacksInterval= 0;
|
||||
flowOptions.speedSmoothingFactor= 0;
|
||||
flowOptions.successStatuses = [""];
|
||||
flowOptions.permanentErrors = [""];
|
||||
|
||||
// flow file
|
||||
flowObject = flowFile.flowObj;
|
||||
var htmlFile: File = flowFile.file;
|
||||
var str: string = flowFile.name;
|
||||
str = flowFile.relativePath;
|
||||
num = flowFile.size;
|
||||
str = flowFile.uniqueIdentifier;
|
||||
num = flowFile.averageSpeed;
|
||||
num = flowFile.currentSpeed;
|
||||
var anyArray: any[] = flowFile.chunks;
|
||||
bool = flowFile.paused;
|
||||
bool = flowFile.error;
|
||||
num = flowFile.progress(true);
|
||||
flowFile.pause();
|
||||
flowFile.resume();
|
||||
flowFile.cancel();
|
||||
flowFile.retry();
|
||||
flowFile.bootstrap();
|
||||
bool = flowFile.isUploading();
|
||||
bool = flowFile.isComplete;
|
||||
num = flowFile.sizeUploaded;
|
||||
num = flowFile.timeRemaining;
|
||||
str = flowFile.getExtension;
|
||||
str = flowFile.getType;
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
// Type definitions for flowjs
|
||||
// Project: https://github.com/flowjs/flow.js
|
||||
// Definitions by: Ryan McNamara <https://github.com/ryan10132>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module flowjs {
|
||||
interface IFlow {
|
||||
support: boolean;
|
||||
supportDirectory: boolean;
|
||||
opts: Object;
|
||||
files: IFlowFile[];
|
||||
|
||||
assignBrowse(domNodes: HTMLElement[], isDirectory: boolean, singleFile: boolean, attributes: Object): void;
|
||||
assignDrop(domNodes: HTMLElement[]): void;
|
||||
unAssignDrop(domNodes: HTMLElement[]): void;
|
||||
on(event: string, callback: Function): void;
|
||||
off(event?: string, callback?: Function): void;
|
||||
upload(): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
cancel(): void;
|
||||
progress(): number;
|
||||
isUploading(): boolean;
|
||||
addFile(file: File): void;
|
||||
removeFile(file: IFlowFile): void;
|
||||
getFromUniqueIdentifier(uniqueIdentifier: string): IFlowFile;
|
||||
getSize(): number;
|
||||
sizeUploaded(): number;
|
||||
timeRemaining(): number;
|
||||
}
|
||||
|
||||
interface IFlowOptions {
|
||||
target?: string;
|
||||
singleFile?: boolean;
|
||||
chunkSize?: number;
|
||||
forceChunkSize?: boolean;
|
||||
simultaneousUploads?: number;
|
||||
fileParameterName?: string;
|
||||
query?: Object;
|
||||
headers?: Object;
|
||||
withCredentials?: boolean;
|
||||
method?: string;
|
||||
testMethod?: string;
|
||||
uploadMethod?: string;
|
||||
allowDuplicateUploads?: boolean;
|
||||
prioritizeFirstAndLastChunk?: boolean;
|
||||
testchunks?: boolean;
|
||||
preprocess?: Function;
|
||||
initFileFn?: Function;
|
||||
generateUniqueIdentifier?: Function;
|
||||
maxChunkRetries?: number;
|
||||
chunkRetryInterval?: number;
|
||||
progressCallbacksInterval?: number;
|
||||
speedSmoothingFactor?: number;
|
||||
successStatuses?: string[];
|
||||
permanentErrors?: string[];
|
||||
}
|
||||
|
||||
interface IFlowFile {
|
||||
flowObj: IFlow;
|
||||
file: File;
|
||||
name: string;
|
||||
relativePath: string;
|
||||
size: number;
|
||||
uniqueIdentifier: string;
|
||||
averageSpeed: number;
|
||||
currentSpeed: number;
|
||||
chunks: any[];
|
||||
paused: boolean;
|
||||
error: boolean;
|
||||
|
||||
progress(relative: boolean): number;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
cancel(): void;
|
||||
retry(): void;
|
||||
bootstrap(): void;
|
||||
isUploading(): boolean;
|
||||
isComplete: boolean;
|
||||
sizeUploaded: number;
|
||||
timeRemaining: number;
|
||||
getExtension: string;
|
||||
getType: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
/// <reference path="ng-flow.d.ts" />
|
||||
|
||||
var flowFactory: ng.flow.IFlowFactory;
|
||||
flowFactory.create(<flowjs.IFlowOptions> {});
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for ng-flow
|
||||
// Project: https://github.com/flowjs/ng-flow
|
||||
// Definitions by: Ryan McNamara <https://github.com/ryan10132>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
/// <reference path="../flowjs/flowjs.d.ts" />
|
||||
|
||||
declare module ng.flow {
|
||||
interface IFlowFactory {
|
||||
create(options?: flowjs.IFlowOptions): flowjs.IFlow;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user