forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flowjs.d.ts
85 lines (80 loc) · 2.56 KB
/
flowjs.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Type definitions for flowjs
// Project: https://github.com/flowjs/flow.js
// Definitions by: Ryan McNamara <https://github.com/ryan10132>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace 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;
}
}