Skip to content

Commit cfd0be8

Browse files
committed
chore: add warning when plugins use :loaded
1 parent 7895785 commit cfd0be8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/base/plugin/events.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ wrap(() => {
1010
function mod(plugin) {
1111
const obj = {
1212
...eventManager,
13-
on(event, fn) {
13+
on(event = '', fn) {
1414
if (typeof fn !== 'function') throw new Error('Must pass a function');
1515

1616
function pluginListener(...args) {
@@ -29,6 +29,10 @@ wrap(() => {
2929
}
3030
pluginListener.plugin = plugin;
3131

32+
if (event.split(' ').includes(':loaded')) {
33+
plugin.logger.warn('Event manager: `:loaded` is deprecated, ask author to update to `:preload`!');
34+
}
35+
3236
eventManager.on.call(obj, event, pluginListener);
3337
},
3438
emit(...args) {

0 commit comments

Comments
 (0)