https://github.com/colmugx/cheatshooter
a cheat code shooter, and also refer to it as `konami code`
https://github.com/colmugx/cheatshooter
Last synced: 3 months ago
JSON representation
a cheat code shooter, and also refer to it as `konami code`
- Host: GitHub
- URL: https://github.com/colmugx/cheatshooter
- Owner: colmugx
- License: mit
- Created: 2023-12-18T10:02:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-27T08:00:53.000Z (8 months ago)
- Last Synced: 2025-01-02T13:47:32.546Z (5 months ago)
- Language: TypeScript
- Size: 240 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-ja.md
- License: LICENSE
Awesome Lists containing this project
README
# cheatshooter
また「コナミコード」とも呼ばれます[](LICENSE)
[](https://github.com/colmugx/cheatshooter/issues)
[](https://github.com/colmugx/cheatshooter/stargazers)## Getting Started
### インストール
```bash
pnpm add cheatcode-shooter
```### 使用法
```typescript
// ところで、最初はcheat-shooterと呼ばれていましたが、npmは`cheat`の使用を許可しませんでした。
import { CheatShooter } from 'cheatcode-shooter';const actions = {
'konami': () => {
// コナミコードのアクション
console.log('konami');
},
// 必要に応じて他のアクションを追加
};const cheatShooter = new CheatShooter(actions);
cheatShooter.on('command', (commandInfo: Output) => {
if (commandInfo) {
console.log(`コマンドが検出されました:${commandInfo.input}`);
} else {
console.log('無効なコマンド');
}
});// 利用可能なコマンドにアクセス
console.log('利用可能なコマンド:', cheatShooter.commands);// CheatShooter が不要になったら破棄する
cheatShooter.destroy();
```## API
### CheatShooter```typescript
interface Output {
step: number;
input: string;
guesses: string[];
}
````new CheatShooter(actions: Record): CheatShooter`
> 指定されたアクションで新しい CheatShooter インスタンスを作成します。`destroy(): void`
> CheatShooter が不要になったときにイベントリスナーを削除し、リソースをクリーンアップします。`on(event: EventType, callback: EventCallback): Function`
> コマンドが検出されたときに呼び出されるコールバック関数を登録します。リスナーを削除する関数が返されます。`commands: string[]`
> 利用可能なチートコマンドの配列。## ライセンス
このプロジェクトは `MIT` ライセンスの下でライセンスされています、詳細については [LICENSE](LICENSE) ファイルを参照してください