Skip to content

Commit 4139f3d

Browse files
authored
Update readme.md
1 parent 75c0e2f commit 4139f3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,16 @@ You can provide a single button within an object, or an array of buttons.
8383

8484
### All Options
8585
```javascript
86-
new SimpleToast({
86+
const toast = new SimpleToast({
8787
title: '',
8888
text: '',
8989
buttons: [...button] || {
9090
text: '',
9191
className: '',
9292
css: {},
93-
onclick() {},
93+
onclick() {
94+
// this; // toast reference
95+
},
9496
},
9597
footer: '',
9698
className: '',
@@ -103,6 +105,11 @@ new SimpleToast({
103105
onClose(reason, toast) {},
104106
});
105107

108+
// Methods on toast
109+
toast.setText(newText); // Change text to newText
110+
toast.exists(); // Does toast still exist?
111+
toast.close(reason); // Close toast for optional reason
112+
106113
SimpleToast.version; // Version in number form
107114
SimpleToast.versionString; // Readable string of version
108115
SimpleToast.count(); // Numer of toasts open

0 commit comments

Comments
 (0)