Constructor
new Counter(id, $divopt)
Counter constructor
| Name | Type | Attributes | Description | 
|---|---|---|---|
id | string | The type of information stored on this counter  | |
$div | external:jQuery | <optional> | The HTML element where this counter will show values (can be null)  | 
- Source
 
Members
$div :external:jQuery
The HTML element where this counter shows its value
- Source
 
MAX_DISPLAY_VALUE :number
Maximum value to be displayed by this counter
- number
 
- Source
 
countDown :number
When set, the counter displays a countdown from this value to zero
- number
 
- Source
 
displayDiffFrom :module:skins/Counter.Counter
An optional Counter used as a subtractor to display the current value.
Useful to display errors subtracting score from actions.
- Source
 
enabled :boolean
Flag indicating if this counter is currently enabled
- boolean
 
- Source
 
id :string
Type of counter (usually: score, actions or time)
- string
 
- Source
 
value :number
Current value of this counter
- number
 
- Source
 
Methods
getDisplayValue() → {number}
Gets the current display value of this counter
- Source
 
- Type:
 - number
 
incValue()
Increments by one the value of this counter
- Source
 
refreshDisplay()
Paints the value of this counter on screen
(method to be overridden by subclasses)
- Source
 
setCountDown(maxValue)
Sets the initial value of the counter
| Name | Type | Description | 
|---|---|---|
maxValue | number | Value from which the countdown will start  | 
- Source
 
setEnabled(enabled)
Enables or disables this counter
| Name | Type | Description | 
|---|---|---|
enabled | boolean | State been assigned to this counter  | 
- Source
 
setValue(value)
Sets a specific value to this counter
| Name | Type | Description | 
|---|---|---|
value | number | The value to set  | 
- Source