forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
async-writer.d.ts
78 lines (67 loc) · 2.3 KB
/
async-writer.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
// Type definitions for async-writer 1.4.1
// Project: https://github.com/marko-js/async-writer
// Definitions by: Yuce Tekol <http://yuce.me/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'async-writer' {
import stream = require('stream');
import events = require('events');
namespace async_writer {
interface EventFunction {
(event: string, callback: Function): void;
}
class StringWriter {
constructor(events: events.EventEmitter);
end(): void;
write(what: string): StringWriter;
toString(): string;
}
class BufferedWriter {
constructor(wrappedStream: stream.Stream);
flush(): void;
on(event: string, callback: Function): BufferedWriter;
once(event: string, callback: Function): BufferedWriter;
clear(): void;
end(): void;
write(what: string): BufferedWriter;
}
interface BeginAsyncOptions {
last?: boolean;
timeout?: number;
name?: string;
}
class AsyncWriter {
static enableAsyncStackTrace():void;
constructor(writer?: any, global?: {[s: string]: any}, async?: boolean, buffer?: boolean);
isAsyncWriter: AsyncWriter;
sync(): void;
getAttributes(): {[s: string]: any};
getAttribute(): any;
write(str: string): AsyncWriter;
getOutput(): string;
captureString(func: Function, thisObj: Object): string;
swapWriter(newWriter: StringWriter | BufferedWriter, func: Function, thisObj: Object): void;
createNestedWriter(writer: StringWriter | BufferedWriter): AsyncWriter;
beginAsync(options?: number | BeginAsyncOptions): AsyncWriter;
handleBeginAsync(options: number | BeginAsyncOptions, parent: AsyncWriter): void;
on(event: string, callback: Function): AsyncWriter;
once(event: string, callback: Function): AsyncWriter;
onLast(callback: Function): AsyncWriter;
emit(arg: any): AsyncWriter;
removeListener(): AsyncWriter;
pipe(stream: stream.Stream): AsyncWriter;
error(e: Error): void;
end(data?: any): AsyncWriter;
handleEnd(isAsync: boolean): void;
_finish(): void;
flush(): void;
}
interface AsyncWriterOptions {
global?: {[s: string]: any};
buffer?: boolean;
}
function create(writer?: any, options?: AsyncWriterOptions): AsyncWriter;
function enableAsyncStackTrace(): void;
}
export = async_writer;
}