Skip to content
This repository was archived by the owner on Jul 31, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { IGridLayout } from './state/interfaces/controls';

/**
* Offers constant information values to use in an application.
*/
export module InteractiveConstants {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for wrapping this inside of a module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where else could you place such information? 🤔 As a static method in Scenes?
Also that way other constants for stuff could be grouped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file is already called constants why not just export it directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured that if there's more constants stuff to be exported in the future, you'd wanna wrap it anyways 😊
Makes it a bit cleaner in my opinion.

Copy link
Contributor

@SimonSchick SimonSchick Jun 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really use modules to wrap things up anywhere in TS, namespaces maybe, but not modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, feel free to change it then!
I won't be able to for the next two weeks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge and change it after.

export const gridLayoutSizes: IGridLayout[] = <IGridLayout[]> Object.freeze([
{
size: 'large',
width: 80,
height: 20,
}, {
size: 'medium',
width: 45,
height: 25,
}, {
size: 'small',
width: 30,
height: 40,
},
]);
}
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export * from './state/Group';
export * from './IClient';
export * from './GameClient';
export * from './ParticipantClient';
export * from './util';
export * from './constants';
export * from './errors';
export * from './util';

/**
* This allows you to specify which WebSocket implementation your
Expand Down
6 changes: 6 additions & 0 deletions src/state/interfaces/controls/IControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import { IMeta } from './IMeta';
export type ControlKind = 'button' | 'joystick';
export type GridSize = 'large' | 'medium' | 'small';

export interface IGridLayout {
readonly size: GridSize;
readonly width: number;
readonly height: number;
}

/**
* Represents the raw data a control has when transmitted
* and received over a socket connection.
Expand Down