Skip to content

Commit d7ab6ff

Browse files
author
Kyle Andrews
committed
Adds TypeScript declarations file
1 parent 98cf5af commit d7ab6ff

File tree

6 files changed

+59
-26
lines changed

6 files changed

+59
-26
lines changed

Notify.d.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
interface NotificationButton {
2+
label: string;
3+
callback: Function;
4+
ariaLabel?: string;
5+
}
6+
interface SnackbarNotification {
7+
message: string;
8+
duration?: number;
9+
closeable?: boolean;
10+
buttons?: Array<NotificationButton>;
11+
position?: string;
12+
element?: HTMLElement;
13+
force?: boolean;
14+
}
15+
export declare class NotificationManager {
16+
private _queue;
17+
private _callback;
18+
private _isRunning;
19+
private _time;
20+
constructor();
21+
private handleCloseClickEvent;
22+
private handleActionButtonClick;
23+
private activateButton;
24+
private createNotification;
25+
private removeNotification;
26+
private startCallback;
27+
private stopCallback;
28+
private animationFrameCallback;
29+
private validateNotification;
30+
notify(notification: SnackbarNotification): void;
31+
}
32+
export {};

Notify.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

global.d.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"description": "A simple JavaScript library for creating and managing snackbar notifications",
55
"main": "Notify.js",
6-
"types": "global.d.ts",
6+
"types": "Notify.d.ts",
77
"files": [
88
"Notify.js",
99
"Notify.js.map",

src/Notify.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
interface NotificationButton
2+
{
3+
label: string,
4+
callback: Function,
5+
ariaLabel?: string,
6+
}
7+
8+
interface SnackbarNotification
9+
{
10+
message: string,
11+
duration?: number,
12+
closeable?: boolean,
13+
buttons?: Array<NotificationButton>,
14+
position?: string,
15+
element?: HTMLElement,
16+
force?: boolean,
17+
}
18+
19+
interface VerificationResponse
20+
{
21+
validNotification: SnackbarNotification,
22+
warnings: Array<string>,
23+
}
24+
125
export class NotificationManager
226
{
327
private _queue: Array<SnackbarNotification>;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"target": "ES2019",
1010
"module": "ESNext",
1111
"moduleResolution": "node",
12+
"declaration": true,
1213
"lib": [
1314
"DOM",
1415
"ES2019"
@@ -20,6 +21,5 @@
2021
],
2122
"include": [
2223
"./src",
23-
"./global.d.ts"
2424
]
2525
}

0 commit comments

Comments
 (0)