-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathspectate.js
More file actions
31 lines (27 loc) · 908 Bytes
/
spectate.js
File metadata and controls
31 lines (27 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import eventManager from 'src/utils/eventManager.js';
import { globalSet } from 'src/utils/global.js';
import { debug } from 'src/utils/debug.js';
import onPage from 'src/utils/onPage.js';
import wrap from 'src/utils/2.pokemon.js';
import { window } from 'src/utils/1.variables.js';
onPage('Spectate', () => {
eventManager.singleton.emit('GameStart');
eventManager.on(':preload', () => {
function callGameHooks(data, original) {
const run = !eventManager.cancelable.emit('PreGameEvent', data).canceled;
if (run) {
wrap(() => original(data));
}
eventManager.emit('GameEvent', data);
}
function hookEvent(event) {
callGameHooks(event, this.super);
}
if (undefined !== window.bypassQueueEvents) {
globalSet('runEvent', hookEvent);
globalSet('bypassQueueEvent', hookEvent);
} else {
debug(`You're a fool.`);
}
});
});