-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
4 changed files
with
121 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Cache } from "../cache"; | ||
import { StrategyConfigs as SC } from "../../../server/utilities/tables"; | ||
import { EventEmitter } from "../../../shared/event-emitter"; | ||
|
||
type StrategyConfigEvents = { | ||
update: undefined; | ||
}; | ||
|
||
type GlobalStrategyConfigEvents = { | ||
new: StrategyConfig; | ||
}; | ||
|
||
export class StrategyConfig extends Cache<StrategyConfigEvents> { | ||
public static readonly emitter = new EventEmitter<GlobalStrategyConfigEvents>(); | ||
|
||
public static on = StrategyConfig.emitter.on.bind(StrategyConfig.emitter); | ||
public static off = StrategyConfig.emitter.off.bind(StrategyConfig.emitter); | ||
public static once = StrategyConfig.emitter.once.bind(StrategyConfig.emitter); | ||
public static emit = StrategyConfig.emitter.emit.bind(StrategyConfig.emitter); | ||
|
||
|
||
|
||
public readonly id: string; | ||
public readonly strategyId: string; | ||
public team: number; | ||
public type: string; | ||
public value: string; | ||
|
||
constructor(config: SC) { | ||
super(); | ||
this.id = config.id; | ||
this.strategyId = config.strategyId; | ||
this.team = config.team; | ||
this.type = config.type; | ||
this.value = config.value; | ||
} | ||
} |
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