-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2799020
commit b5b4553
Showing
89 changed files
with
1,133 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/core/event-source/source-builder/fromLevelManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { levelManager } from '../../battle/index.js'; | ||
import { SEAEventSource } from '../EventSource.js'; | ||
|
||
type LevelManagerEvents = 'update' | 'nextAction' | 'log'; | ||
|
||
export function fromLevelManager(event: 'update'): SEAEventSource<void>; | ||
export function fromLevelManager(event: 'nextAction' | 'log'): SEAEventSource<string>; | ||
|
||
export function fromLevelManager(event: LevelManagerEvents) { | ||
switch (event) { | ||
case 'update': | ||
return new SEAEventSource(levelManager.update$); | ||
case 'nextAction': | ||
return new SEAEventSource(levelManager.nextAction$); | ||
case 'log': | ||
return new SEAEventSource(levelManager.log$); | ||
default: | ||
throw new Error(`Invalid type ${event as string}, type could only be 'update'`); | ||
} | ||
} |
Oops, something went wrong.