Skip to content

Commit 7c2004b

Browse files
committed
fix: Don't expose internal toast
Also use "call" instead of simply running the function (this is breaking but no one uses my script anyway but me, yeah? :P)
1 parent b64e67f commit 7c2004b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

simpletoast.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
console.log(`SimpleToast(v${localToast.versionString}): Publicized`);
1515
}
1616
})(this, () => {
17-
const version = buildVersion(1, 12, 0);
17+
const version = buildVersion(1, 13, 0);
1818
const style = {
1919
root: {
2020
display: 'flex',
@@ -166,6 +166,7 @@
166166
}
167167

168168
let closeType = 'unknown';
169+
const safeToast = {};
169170
const toast = {
170171
setText: (newText) => {
171172
if (!newText || !toast.exists()) return;
@@ -177,7 +178,7 @@
177178
root.removeChild(el);
178179
toasts.delete(id);
179180
if (typeof onClose === 'function') {
180-
onClose(toast, closeType);
181+
onClose.call(safeToast, closeType, safeToast);
181182
}
182183
},
183184
timedout: () => {
@@ -235,7 +236,6 @@
235236
if (timeout) {
236237
startTimeout();
237238
}
238-
const safeToast = {};
239239
Object.keys(blankToast).forEach((key) => safeToast[key] = toast[key]);
240240
return safeToast;
241241
}

0 commit comments

Comments
 (0)