Skip to content

Latest commit

 

History

History
1801 lines (1143 loc) · 43.4 KB

api.md

File metadata and controls

1801 lines (1143 loc) · 43.4 KB

Classes

FightSettings
Fight
FightHistory
Opponent
OpponentGroup
Person
Playlist
Entry
Tournament
FightEmitter
FightEmitterLocal
FightReceiver
FightReceiverLocal
LocalBroker
Repertoire
Scoreboard

Objects

Direzione.FightSettings : object
Direzione.Fight : object
Direzione.FightHistory : object
Direzione.Opponent : object
Direzione.OpponentGroup : object
Direzione.Person : object
Direzione.Playlist : object
Direzione : object
Direzione.FightEmitter : object
Direzione.FightEmitterLocal : object
Direzione.FightReceiver : object
Direzione.FightReceiverLocal : object
Direzione.LocalBroker : object
Direzione.RoundRobinTournamentIterator : object
Direzione.Utils : object
Direzione.Repertoire : object
Direzione.Scoreboard : object

FightSettings ℗

Kind: global class Access: private


fightSettings.toStorage()

Puts the settings to the local storage

Kind: instance method of FightSettings Access: public


fightSettings.fromStorage()

Fetches the settings from the local storage and applies them to this object

Kind: instance method of FightSettings Access: public


Fight ℗

Kind: global class Access: private


new Fight(settings, whiteOpponent, redOpponent, noHistory)

Param Type
settings FightSettings
whiteOpponent Opponent
redOpponent Opponent
noHistory Boolean

fight.getHistory() ⇒ FightHistory

Returns the object that holds the fight history

Kind: instance method of Fight Access: public


fight.getCountDown() ⇒ DurataSingleValue | false

Returns the object to process countdown

Kind: instance method of Fight Access: public


fight.getCountUp() ⇒ DurataSingleValue | false

Returns the object to process count up

Kind: instance method of Fight Access: public


fight.getWhiteOpponent() ⇒ Opponent

Returns the object to manage the judika on white side

Kind: instance method of Fight Access: public


fight.getRedOpponent() ⇒ Opponent

Returns the object to manage the judika on red side

Kind: instance method of Fight Access: public


fight.isStopped() ⇒ Boolean

Returns whether the fight is going on

Kind: instance method of Fight Access: public


fight.invertSide() ⇒ String

Inverts passed side; Makes left from right and right from left - keeps center ...

Kind: instance method of Fight Access: public


fight.isRunning() ⇒ Boolean

Returns whether the fight is still going on

Kind: instance method of Fight Access: public


fight.getTimeLeft() ⇒ Integer

Returns remainig milliseconds until the fight ends

Kind: instance method of Fight Access: private


fight.on(type, callback) ℗

Registers an event-listener to this object

Kind: instance method of Fight Access: private

Param Type
type String
callback function

fight.clearListeners(externalOnly)

Removes all listeners of this object

Kind: instance method of Fight Access: public

Param Type Description
externalOnly Boolean Default true

fight.reset(forceMS)

Resets the fight (Time and score to initial values)

Kind: instance method of Fight Emits: reset Access: public

Param Type Description
forceMS Integer Optional - If this is passed to the function, the countdown will be forced to this millisecond value

fight.togglePauseResume() ℗

Toggles pause and resume for the countdown

Kind: instance method of Fight Access: private


fight.startPauseResume(forceMS) ℗

Starts, pauses or resumes the fight

Kind: instance method of Fight Emits: startPauseResume Access: private

Param Type Description
forceMS Integer Optional milliseconds the countdown should be forced to

fight.osaeKomi(side, forceMS) ℗

Starts count up for osae komi

Kind: instance method of Fight Emits: osaeKomi Access: private

Param Type Description
side String defines which opponent holds the other down ("red", "white" or "center")
forceMS Integer Milliseconds the count up should be forced to

fight.stop(msDownForce, msUpForce, side) ℗

Stops the fight

Kind: instance method of Fight Emits: stop Access: private

Param Type Description
msDownForce Integer Optional milliseconds the countdown should be forced to
msUpForce Integer Optional milliseconds the count up should be forced to
side String defines which opponent holds the other down ("red", "white" or "center")

fight.toketa(forceMS) ℗

Pauses the count up for osae komi

Kind: instance method of Fight Access: private

Param Type Description
forceMS Integer Optional milliseconds the count up should be forced to

"reset"

Will be fired when the score and time of a fight has been reset

Kind: event emitted by Fight


"startPauseResume"

Will be fired when countdown has been started, paused or resumed

Kind: event emitted by Fight


"osaeKomi"

Will be fired when count up has been started

Kind: event emitted by Fight


"stop"

Will be fired when the countdown has been stopped (fight ended)

Kind: event emitted by Fight


"toketa"

Will be fired when count up has been stopped

Kind: event emitted by Fight


"removeCountUp"

Will be fired when count up has been removed

Kind: event emitted by Fight


FightHistory ℗

Kind: global class Access: private


new FightHistory(fight)

Param Type
fight Fight

Opponent ℗

Kind: global class Access: private


new Opponent(person, score, penalty)

Param Type
person Person
score Integer
penalty Integer

opponent.on(type, callback)

Registers an event-listener to this object

Kind: instance method of Opponent Access: public

Param Type
type String
callback function

opponent.clearListeners()

Removes all listerners of this object

Kind: instance method of Opponent Access: public


opponent.getClubName() ⇒ String

Returns the name of the club, where the opponent is member of

Kind: instance method of Opponent Access: public


opponent.getFullName() ⇒ String

Returns the firstname and lastname of the opponent

Kind: instance method of Opponent Access: public


opponent.getScore() ⇒ Integer

Returns the score of the opponent

Kind: instance method of Opponent Access: public


opponent.getShido() ⇒ Integer

Returns the penalty score of the opponent

Kind: instance method of Opponent Access: public


opponent.addIppon()

Adds amount of points for ippon to score of the opponent

Kind: instance method of Opponent Emits: add Access: public


opponent.addShido()

Adds a penalty point to the penalty score of the opponent

Kind: instance method of Opponent Emits: add Access: public


opponent.addWazari()

Adds amount of points for wazari to score of the opponent

Kind: instance method of Opponent Emits: add Access: public


opponent.removeIppon()

Removes amount of points for ippon from score of the opponent

Kind: instance method of Opponent Emits: remove Access: public


opponent.removeShido()

Removes a penalty point from the penalty score of the opponent

Kind: instance method of Opponent Emits: remove Access: public


opponent.removeWazari()

Removes amount of points for wazari from score of the opponent

Kind: instance method of Opponent Emits: remove Access: public


opponent.reset()

Resets the score and penalty of the opponent

Kind: instance method of Opponent Emits: reset Access: public


opponent.on(type, callback)

Registers an event-listener to this object

Kind: instance method of Opponent Access: public

Param Type
type String
callback function

"add"

Will be fired when score has been changed, when added

Kind: event emitted by Opponent


"remove"

Will be fired when score has been changed, when removed

Kind: event emitted by Opponent


"reset"

Will be fired when score has been reset

Kind: event emitted by Opponent


OpponentGroup ℗

Kind: global class Access: private


new OpponentGroup(name)

Param Type
name String

Person ℗

Kind: global class Access: private


new Person(firstName, lastName, club)

Param Type
firstName String
lastName String
club String

person.getClubName() ⇒ String

Returns the name of the club, where the Person is member of

Kind: instance method of Person Access: public


person.getFirstName() ⇒ String

Returns the firstname of the Person

Kind: instance method of Person Access: public


person.getLastName() ⇒ String

Returns the lastname of the Person

Kind: instance method of Person Access: public


person.getLockOut(ms)

Sets persons lock-out time in milliseconds

Kind: instance method of Person Access: public

Param Type
ms Integer

person.getLockOut() ⇒ false | Durata

Returns the lock-out, if set

Kind: instance method of Person Access: public


person.reset()

Resets the lock-out

Kind: instance method of Person Access: public


Playlist ℗

Kind: global class Access: private


new Playlist()

Class to manage a list of fights as playlist


playlist.empty() ⇒ Playlist

Empty paylist

Kind: instance method of Playlist Returns: Playlist - - Returns the Playlist instance which this method is called Access: public


playlist.insert(fight) ⇒ int

Adds a fight object right after the cursor node of the playlist and returns the new length of the list

Kind: instance method of Playlist Returns: int - - The new length of the list Access: public

Param Type
fight Fight

playlist.find(callback, [fromIndex]) ⇒ Fight | undefined

Returns the value of the first fight-element in the list that satisfies the provided testing function. Otherwise undefined is returned

Kind: instance method of Playlist Returns: Fight | undefined - - A value in the list if a fight-element passes the test; otherwise, undefined Access: public

Param Type Default Description
callback function Function to test for each fight-element
[fromIndex] int 0 The position in this list at which to begin searching for searchElement

playlist.includes(searchElement, [fromIndex]) ⇒ Boolean

Determines whether a list includes a certain fight-element, returning true or false as appropriate

Kind: instance method of Playlist Returns: Boolean - - true if the searchElement found in the list; otherwise, false Access: public

Param Type Default Description
searchElement Fight The fight-element to search for
[fromIndex] int 0 The position in this list at which to begin searching for searchElement

playlist.remove(fight, [fromIndex]) ⇒ Fight

Removes a fight-element from the list

Kind: instance method of Playlist Returns: Fight - - Returns removed fight-element if found, undefined otherwise Access: public

Param Type Default Description
fight Fight The fight-element to be removed from playlist
[fromIndex] int 0 The position in this list at which to begin searching for the fight-element

playlist.next() ⇒ Fight

Moves cursor to the next entry and returns the fight-object in it

Kind: instance method of Playlist Returns: Fight - - Returns fight-object of next node to the cursor. If cursor reaches to the end, it returns undefined Access: public


playlist.prev() ⇒ Fight

Moves cursor to the previous entry and returns the fight-object in it

Kind: instance method of Playlist Returns: Fight - - Returns fight-object of previous node to the cursor. If cursor reaches to the head, it returns undefined Access: public


playlist.reset() ⇒ Playlist

Resets cursor to head

Kind: instance method of Playlist Returns: Playlist - - Returns the Playlist instance which this method is called Access: public


Entry ℗

Kind: global class Access: private


new Entry(list, fight)

Class to manage the entries in the playlist

Param Type
list Playlist
fight Fight

Tournament ℗

Kind: global class Access: private


FightEmitter ℗

Kind: global class Access: private


new FightEmitter(receiverID, fight, servers)

Param Type
receiverID String
fight Fight
servers Array

fightEmitter.isConnected() ⇒ Boolean

Returns whether the connection to a FightReceiver is established

Kind: instance method of FightEmitter Access: public


fightEmitter.getFight()

Returns the fight

Kind: instance method of FightEmitter Access: public


fightEmitter.replaceFight()

Replaces the fight of this emitter and emits the new object

Kind: instance method of FightEmitter Access: public


fightEmitter.disconnect()

Trys to disconnect from the connected FightReceiver

Kind: instance method of FightEmitter Access: public


fightEmitter.connect() ⇒ Promise

Trys to connect to a FightReceiver with given ID

Kind: instance method of FightEmitter Emits: establish, disconnect Access: public


fightEmitter.on(type, callback)

Registers an event-listener to this object

Kind: instance method of FightEmitter Access: public

Param Type
type String
callback function

"disconnect"

Will be fired when peer connection was disconnected

Kind: event emitted by FightEmitter


"establish"

Will be fired when peer connection has been established

Kind: event emitted by FightEmitter


FightEmitterLocal ℗

Kind: global class Access: private


new FightEmitterLocal(receiverID, fight)

Param Type
receiverID String
fight Fight

fightEmitterLocal.isConnected() ⇒ Boolean

Returns whether the connection to a FightReceiver is established

Kind: instance method of FightEmitterLocal Access: public


fightEmitterLocal.getFight()

Returns the fight

Kind: instance method of FightEmitterLocal Access: public


fightEmitterLocal.replaceFight()

Replaces the fight of this emitter and emits the new object

Kind: instance method of FightEmitterLocal Access: public


fightEmitterLocal.disconnect()

Trys to disconnect from the connected FightReceiver

Kind: instance method of FightEmitterLocal Access: public


fightEmitterLocal.connect() ⇒ Promise

Trys to connect to a FightReceiver with given ID

Kind: instance method of FightEmitterLocal Emits: establish, disconnect Access: public


fightEmitterLocal.on(type, callback)

Registers an event-listener to this object

Kind: instance method of FightEmitterLocal Access: public

Param Type
type String
callback function

"disconnect"

Will be fired when peer connection was disconnected

Kind: event emitted by FightEmitterLocal


"establish"

Will be fired when peer connection has been established

Kind: event emitted by FightEmitterLocal


FightReceiver ℗

Kind: global class Access: private


new FightReceiver(receiverID, viewConfig, servers)

Param Type
receiverID String
viewConfig Object
servers Array

fightReceiver.isConnected() ⇒ Boolean

Returns whether the connection to a FightReceiver is established

Kind: instance method of FightReceiver Access: public


fightReceiver.on(type, callback)

Registers an event-listener to this object

Kind: instance method of FightReceiver Access: public

Param Type
type String
callback function

"disconnect"

Will be fired when peer connection was disconnected

Kind: event emitted by FightReceiver


"establish"

Will be fired when peer connection has been established

Kind: event emitted by FightReceiver


FightReceiverLocal ℗

Kind: global class Access: private


new FightReceiverLocal(receiverID, viewConfig)

Param Type
receiverID String
viewConfig Object

fightReceiverLocal.isConnected() ⇒ Boolean

Returns whether the connection to a FightReceiver is established

Kind: instance method of FightReceiverLocal Access: public


fightReceiverLocal.on(type, callback)

Registers an event-listener to this object

Kind: instance method of FightReceiverLocal Access: public

Param Type
type String
callback function

"disconnect"

Will be fired when peer connection was disconnected

Kind: event emitted by FightReceiverLocal


"establish"

Will be fired when peer connection has been established

Kind: event emitted by FightReceiverLocal


LocalBroker ℗

Kind: global class Access: private


Repertoire ℗

Kind: global class Access: private


new Repertoire(playlistModel, viewConfig)

Param Type
playlistModel Playlist
viewConfig Object

Scoreboard ℗

Kind: global class Access: private


new Scoreboard(fightModel, viewConfig)

Param Type
fightModel Fight
viewConfig Object

scoreboard.run()

Starts the update process for the display

Kind: instance method of Scoreboard Access: public


scoreboard.stop()

Stops the update process for the display

Kind: instance method of Scoreboard Access: public


scoreboard.replaceFight()

Replaces the present fight

Kind: instance method of Scoreboard Access: public


scoreboard.showNames()

Displays Names of opponents

Kind: instance method of Scoreboard Access: public


scoreboard.hideNames()

Hides Names of opponents

Kind: instance method of Scoreboard Access: public


scoreboard.shutdown()

Shuts the scoreboard display down

Kind: instance method of Scoreboard Access: public


Direzione.FightSettings : object

Kind: global namespace


Direzione.FightSettings.create() ⇒ FightSettings

Creates an object to manage settings to a fight

Kind: static method of Direzione.FightSettings


Direzione.Fight : object

Kind: global namespace


Direzione.Fight.create(settings, thousandsSeparator, decimalCount, noHistory) ⇒ Fight

Creates an object to manage a fight.

Kind: static method of Direzione.Fight

Param Type
settings FightSettings
thousandsSeparator Opponent
decimalCount Opponent
noHistory Boolean

Direzione.FightHistory : object

Kind: global namespace


Direzione.FightHistory.create(fight) ⇒ FightHistory

Creates an object to manage a the history of a fight.

Kind: static method of Direzione.FightHistory

Param Type
fight Fight

Direzione.Opponent : object

Kind: global namespace


Direzione.Opponent.create(person, score, penalty) ⇒ Opponent

Creates an object to manage a opponent (in a fight).

Kind: static method of Direzione.Opponent

Param Type
person Person
score Integer
penalty Integer

Direzione.OpponentGroup : object

Kind: global namespace


Direzione.OpponentGroup.create(name) ⇒ OpponentGroup

Creates an object to organize opponents in groups.

Kind: static method of Direzione.OpponentGroup

Param Type
name String

Direzione.Person : object

Kind: global namespace


Direzione.Person.create(firstName, lastName, club) ⇒ Person

Creates an object to manage a fight.

Kind: static method of Direzione.Person

Param Type
firstName String
lastName String
club String

Direzione.Playlist : object

Kind: global namespace


Direzione.Playlist.create() ⇒ Playlist

Creates an object of a double linked list holding fights and acts as playlist.

Kind: static method of Direzione.Playlist


Direzione : object

Kind: global namespace


Direzione.FightEmitter : object

Kind: global namespace


Direzione.FightEmitter.create(receiverID, fight) ⇒ FightEmitter

Creates an object to emit fight events to a receiver.

Kind: static method of Direzione.FightEmitter

Param Type
receiverID String
fight Fight

Direzione.FightEmitterLocal : object

Kind: global namespace


Direzione.FightEmitterLocal.create(receiverID, fight) ⇒ FightEmitterLocal

Creates an object to emit fight events to a receiver.

Kind: static method of Direzione.FightEmitterLocal

Param Type
receiverID String
fight Fight

Direzione.FightReceiver : object

Kind: global namespace


Direzione.FightReceiver.create(receiverID, viewConfig) ⇒ FightReceiver

Creates an object to receive scoreboard events from a emitter scoreboard.

Kind: static method of Direzione.FightReceiver

Param Type
receiverID String
viewConfig Object

Direzione.FightReceiverLocal : object

Kind: global namespace


Direzione.FightReceiverLocal.create(receiverID, viewConfig) ⇒ FightReceiverLocal

Creates an object to receive scoreboard events from a emitter scoreboard.

Kind: static method of Direzione.FightReceiverLocal

Param Type
receiverID String
viewConfig Object

Direzione.LocalBroker : object

Kind: global namespace


Direzione.LocalBroker.create() ⇒ LocalBroker

Realizes a broker between two peers over the local storage

Kind: static method of Direzione.LocalBroker


Direzione.RoundRobinTournamentIterator : object

Kind: global namespace


Direzione.RoundRobinTournamentIterator.create(arr)

Creates an object to iterate through an array.

Kind: static method of Direzione.RoundRobinTournamentIterator

Param Type
arr Array

Direzione.Utils : object

Kind: global namespace


Direzione.Utils.loadTranslationJS(path, callback) ⇒ String

Loads a JS-file from a given path and passes the so (hopefully) loaded member variable "Direzione.translation" to the given callback-function

Kind: static method of Direzione.Utils Access: public

Param Type
path String
callback function

Direzione.Repertoire : object

Kind: global namespace


Direzione.Repertoire.create(playlistModel, viewConfig) ⇒ Repertoire

Creates an object to update a scoreboard.

Kind: static method of Direzione.Repertoire

Param Type
playlistModel Playlist
viewConfig Object

Direzione.Scoreboard : object

Kind: global namespace


Direzione.Scoreboard.create(fightModel, viewConfig) ⇒ Scoreboard

Creates an object to update a scoreboard.

Kind: static method of Direzione.Scoreboard

Param Type
fightModel Fight
viewConfig Object