Initial commit
This commit is contained in:
22
src/lib/gmcp/packages/ClientKeystrokePackage.ts
Normal file
22
src/lib/gmcp/packages/ClientKeystrokePackage.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { EventEmitter } from '$lib/utils/EventEmitter';
|
||||
import type { GmcpPackageHandler } from './GmcpPackageHandler';
|
||||
|
||||
export class ClientKeystrokePackage implements GmcpPackageHandler {
|
||||
public readonly packageName = 'Client.Keystroke';
|
||||
public readonly version = '1';
|
||||
private emitter: EventEmitter | null = null;
|
||||
|
||||
initialize(emitter: EventEmitter): void {
|
||||
this.emitter = emitter;
|
||||
}
|
||||
|
||||
handleMessage(module: string, data: any): void {
|
||||
if (module === 'Client.Keystroke.Capture') {
|
||||
// Handle keystroke capture request
|
||||
this.emitter?.emit('captureKeystroke', data.keys || [], data.type || 'all');
|
||||
} else if (module === 'Client.Keystroke.Release') {
|
||||
// Handle keystroke release request
|
||||
this.emitter?.emit('releaseKeystroke');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user