Skip to content

Commit 64112d5

Browse files
author
Kyle Andrews
committed
Closes #5
1 parent b4a6dc0 commit 64112d5

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
### Added
1313

14-
- toaster notification `toast()` creation
14+
- toaster notification `toast()` creation [#5](https://github.com/codewithkyle/notifyjs/issues/5)
15+
- renames existing notification funciton to `snackbar()`
1516

1617
## [1.1.0] - 2020-02-11
1718

src/Notify.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { NotificationManager } from "./notification-manager";
22

33
const globalManager = new NotificationManager();
44

5+
/**
6+
* @deprecated Use `snackbar()` instead
7+
*/
58
const notify: (notification: {
69
message: string;
710
duration?: number;
@@ -16,6 +19,20 @@ const notify: (notification: {
1619
classes?: Array<string> | string;
1720
}) => void = globalManager.notify.bind(globalManager);
1821

22+
const snackbar: (notification: {
23+
message: string;
24+
duration?: number;
25+
closeable?: boolean;
26+
buttons?: Array<{
27+
label: string;
28+
callback: Function;
29+
ariaLabel?: string;
30+
classes?: Array<string> | string;
31+
}>;
32+
force?: boolean;
33+
classes?: Array<string> | string;
34+
}) => void = globalManager.snackbar.bind(globalManager);
35+
1936
const toast: (notification: {
2037
title: string;
2138
message: string;
@@ -26,4 +43,4 @@ const toast: (notification: {
2643
element?: HTMLElement;
2744
}) => void = globalManager.toast.bind(globalManager);
2845

29-
export { NotificationManager, notify, toast };
46+
export { NotificationManager, notify, toast, snackbar };

src/notification-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ export class NotificationManager {
333333
});
334334
}
335335

336+
public snackbar = this.notify;
337+
336338
private removeToasterNotification(notification: ToasterNotification, id: number) {
337339
notification.element.remove();
338340
this.toaster.splice(id, 1);

0 commit comments

Comments
 (0)