Skip to content

Commit ffcb29f

Browse files
committed
fix: infoToast only works after it's loaded
1 parent db585de commit ffcb29f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/utils/menu.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,15 @@ const menu = (() => {
119119
}
120120
}
121121

122-
toast = fn.infoToast({
123-
text: 'UnderScript has a menu, press ESC to open it!',
124-
onClose: (reason) => {
125-
toast = null;
126-
return reason !== 'opened';
127-
},
128-
}, 'underscript.notice.menu', '1');
122+
eventManager.on('UnderScript:loaded', () => {
123+
toast = fn.infoToast({
124+
text: 'UnderScript has a menu, press ESC to open it!',
125+
onClose: (reason) => {
126+
toast = null;
127+
return reason !== 'opened';
128+
},
129+
}, 'underscript.notice.menu', '1');
130+
});
129131

130132
return {
131133
open, close, isOpen, addButton,

0 commit comments

Comments
 (0)