API Docs for: 0.0.2
Show:

chess.view.command.Controller Class

Extends controller.Controller
Module: View

Controller for the command line view

Methods

addControllerEvents

()

Add listeners to the controller

errorMessage

(
  • msg
)

Fire a "sendErrorMessage" event. A chess.view.command.Panel view will listen to this event and display the error message on screen

Parameters:

execute

(
  • command
  • arg
)

Execute a command

Parameters:

getCommandArguments

(
  • message
)
String private

Extract command arguments from command message. The whole message would be returned when message is not a valid command.

Parameters:

Returns:

Example:

var args = controller.getCommandArguments('move e4'); // will return "e4"

getValidCommand

(
  • command
)
String | Undefined private

Return valid command name

Parameters:

Returns:

String | Undefined:

isChessMove

(
  • move
)
Boolean

Using RegEx to validate a chess move.

Parameters:

Returns:

isValidGrade

(
  • arg
)
Boolean

Returns true if passed argument is a valid move grade/short comment, i.e. !,?,!!,??,!? or ?!

Parameters:

Returns:

message

(
  • msg
)

Fire a "sendMessage" event. Listening views may display this message on screen (example a chess.view.command.Panel view).

Parameters:

onInvalidMove

()

Show invalid move message

receiveMove

(
  • controller
  • move
)
private

Receive move from main controller and display move message on screen

Parameters:

recieveMoveUpdate

(
  • model
  • move
)

Receive move update from main controller and fire a message event which will be displayed by a chess.view.command.Panel view

Parameters:

showHelp

()

Show command line help screen