MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / bind

Method bind

src/actions/End.ts:7–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5 static override id = 'End';
6
7 static override async bind(): Promise<void> {
8 this.engine.registerListener('end', {
9 keys: 'shift+q',
10 callback: () => {
11 if (this.engine.global('playing')) {
12 this.engine.alert('quit-warning', {
13 message: 'Confirm',
14 actions: [
15 {
16 label: 'Quit',
17 listener: 'quit'
18 },
19 {
20 label: 'Cancel',
21 listener: 'dismiss-alert'
22 }
23 ]
24 });
25 }
26 }
27 });
28
29 this.engine.registerListener('quit', {
30 callback: () => {
31 this.engine.dismissAlert('quit-warning');
32
33 if (this.engine.global('playing') === true) {
34 this.engine.run('end');
35 return;
36 }
37
38 const bridge = getDesktopBridge();
39
40 if (bridge) {
41 bridge.send('quit-request');
42 }
43 }
44 });
45 }
46
47 static override matchString([action]: string[]): boolean {
48 return action === 'end';

Callers 2

keyboardShortcutFunction · 0.45
characters.tsFile · 0.45

Calls 7

getDesktopBridgeFunction · 0.90
registerListenerMethod · 0.80
globalMethod · 0.80
alertMethod · 0.80
dismissAlertMethod · 0.80
sendMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected