forked from adopted-ember-addons/ember-cli-flash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
61 lines (51 loc) · 1.55 KB
/
index.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
declare module 'ember-cli-flash/flash/object' {
import EmberObject from '@ember/object';
import Evented from '@ember/object/evented';
class FlashObject extends EmberObject.extend(Evented) {
exiting: boolean;
exitTimer: number;
isExitable: boolean;
initializedTime: number;
destroyMessage(): void;
exitMessage(): void;
preventExit(): void;
allowExit(): void;
timerTask(): void;
exitTimerTask(): void;
}
export default FlashObject;
}
declare module 'ember-cli-flash/services/flash-messages' {
import Service from '@ember/service';
import FlashObject from 'ember-cli-flash/flash/object';
type Partial<T> = { [K in keyof T]?: T[K] };
interface MessageOptions {
type: string;
priority: number;
timeout: number;
sticky: boolean;
showProgress: boolean;
extendedTimeout: number;
destroyOnClick: boolean;
onDestroy: () => void;
}
interface CustomMessageInfo extends Partial<MessageOptions> {
message: string;
}
interface FlashFunction {
(message: string, options?: Partial<MessageOptions>): FlashMessageService;
}
class FlashMessageService extends Service {
success: FlashFunction;
warning: FlashFunction;
info: FlashFunction;
danger: FlashFunction;
alert: FlashFunction;
secondary: FlashFunction;
add(messageInfo: CustomMessageInfo): FlashMessageService;
clearMessages(): FlashMessageService;
registerTypes(types: string[]): FlashMessageService;
getFlashObject(): FlashObject;
}
export default FlashMessageService;
}