Skip to content

Commit

Permalink
refactor(api): Move api-hooks.ts from api to api/impl
Browse files Browse the repository at this point in the history
  • Loading branch information
jcowman2 committed Dec 14, 2018
1 parent c4d73ca commit 6afcfee
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/api-hook-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { TrackedEvent } from "../events";
import { GameInstance } from "../state";
import { returnTrue } from "./api-hooks";
import { returnTrue } from "./impl";

/**
* Manager for the Game's API hooks.
Expand Down
8 changes: 4 additions & 4 deletions src/api/api-hooks.ts → src/api/impl/api-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* Licensed under MIT License (see https://github.com/regal/regal)
*/

import { RegalError } from "../error";
import { EventFunction, isTrackedEvent, on } from "../events";
import { GameInstance } from "../state";
import { HookManager } from "./api-hook-manager";
import { RegalError } from "../../error";
import { EventFunction, isTrackedEvent, on } from "../../events";
import { GameInstance } from "../../state";
import { HookManager } from "../api-hook-manager";

/** Default implementation of `beforeUndoCommandHook`; always returns true. */
export const returnTrue = (game: GameInstance) => true;
Expand Down
13 changes: 13 additions & 0 deletions src/api/impl/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* The purpose of this file is to abstract all api-related implementations
* by re-exporting their constructors from a single file.
*
* Copyright (c) 2018 Joseph R Cowman
* Licensed under MIT License (see https://github.com/regal/regal)
*/
export {
onPlayerCommand,
onStartCommand,
onBeforeUndoCommand,
returnTrue
} from "./api-hooks";
6 changes: 1 addition & 5 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@

export { GameResponse, GameResponseOutput } from "./game-response";
export { Game } from "./game-api";
export {
onPlayerCommand,
onStartCommand,
onBeforeUndoCommand
} from "./api-hooks";
export { onPlayerCommand, onStartCommand, onBeforeUndoCommand } from "./impl";
export { HookManager } from "./api-hook-manager";

0 comments on commit 6afcfee

Please sign in to comment.