Face(value, attributesopt)

new Face(value, attributesopt)

This class is meant to be provide an interface for all other faces to extend.

Parameters:
Name Type Attributes Description
value FaceValue | object

The Face value. If not an instance of FaceValue, this argument is assumed to be the instance attributes.

attributes object | undefined <optional>

The instance attributes.

Source:

Extends

Members

dataType :*

The dataType attribute.

Type:
  • *
Source:

events :object

The events attribute.

Type:
  • object
Inherited From:
Source:

name :string

Get the name attribute.

Type:
  • string
Inherited From:
Source:

originalValue :*

The originalValue attribute.

Type:
  • *
Source:

stopAt :*

The stopAt attribute.

Type:
  • *
Source:

value :*

The value attribute.

Type:
  • *
Source:

Methods

callback(fn) → {*}

Helper method to execute the callback() function.

Parameters:
Name Type Description
fn function

The callback function.

Inherited From:
Source:
Returns:
  • Returns the executed callback function.
Type
*

createFaceValue(instance, attributesopt) → {Divider}

Helper method to instantiate a new FaceValue.

Parameters:
Name Type Attributes Description
instance FlipClock

The FlipClock instance.

attributes object | undefined <optional>

The attributes passed to the FaceValue instance.

Source:
Returns:
  • The instantiated FaceValue.
Type
Divider

decrement(instance, amountopt) → {void}

Decrement the clock.

Parameters:
Name Type Attributes Description
instance FlipClock

The FlipClock instance.

amount Number <optional>

The amount to decrement. If the amount is not defined, it is left up to the Face to determine the default value.

Source:
Returns:
Type
void

defaultAttributes() → {Object|undefined}

The default attributes for the Face.

Source:
Returns:
  • The default attributes.
Type
Object | undefined

defaultDataType() → {Object|undefined}

The default data type for the Face value.

Source:
Returns:
  • The default data type.
Type
Object | undefined

defaultValue() → {*}

The default value for the Face.

Source:
Returns:
  • The default value.
Type
*

emit(key) → {Component}

Emit an event.

Parameters:
Name Type Description
key string

The event id/key.

Inherited From:
Source:
Returns:
  • Returns this instance.
Type
Component

format(instance, value) → {*}

By default this just returns the value unformatted.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

value *

The value to format.

Source:
Returns:
  • The formatted value.
Type
*

getAttribute(key) → {*}

Get an attribute. Returns null if no attribute is defined.

Parameters:
Name Type Description
key string

The attribute name.

Inherited From:
Source:
Returns:
  • The attribute value.
Type
*

getAttributes() → {object}

Get all the atttributes for this instance.

Inherited From:
Source:
Returns:
  • The attribute dictionary.
Type
object

getPublicAttributes() → {object}

Get only public the atttributes for this instance. Omits any attribute that starts with $, which is used internally.

Inherited From:
Source:
Returns:
  • The attribute dictionary.
Type
object

increment(instance, amountopt) → {void}

Increment the clock.

Parameters:
Name Type Attributes Description
instance FlipClock

The FlipClock instance.

amount Number <optional>

The amount to increment. If the amount is not defined, it is left up to the Face to determine the default value.

Source:
Returns:
Type
void

initialized(instance) → {void}

This method is called right after Face has initialized.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void

interval(instance, fn) → {Face}

This method is called with every interval, or every time the clock should change, and handles the actual incrementing and decrementing the clock's FaceValue.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

fn function

The interval callback.

Source:
Returns:
  • This Face instance.
Type
Face

mounted(instance) → {void}

This method is called right after Face has mounted.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void

off(key, fn) → {Component}

Stop listening to an event.

Parameters:
Name Type Description
key string

The event id/key.

fn function | undefined

The listener callback function. If no function is defined, all events with the specified id/key will be removed. Otherwise, only the event listeners matching the id/key AND callback will be removed.

Inherited From:
Source:
Returns:
  • Returns this instance.
Type
Component

on(key, fn, onceopt) → {Component}

Start listening to an event.

Parameters:
Name Type Attributes Default Description
key string

The event id/key.

fn function

The listener callback function.

once boolean <optional>
false

Should the event handler be fired a single time.

Inherited From:
Source:
Returns:
  • Returns this instance.
Type
Component

once(key, fn) → {Component}

Listen to an event only one time.

Parameters:
Name Type Description
key string

The event id/key.

fn function

The listener callback function.

Inherited From:
Source:
Returns:
  • Returns this instance.
Type
Component

rendered(instance) → {void}

This method is called right after Face has rendered.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void

reset(instance) → {void}

This method is called right after clock has reset.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void

setAttribute(key, value) → {void}

Set an attribute key and value.

Parameters:
Name Type Description
key string

The attribute name.

value *

The attribute value.

Inherited From:
Source:
Returns:
Type
void

setAttributes(values) → {void}

Set an attributes by object of key/value pairs.

Parameters:
Name Type Description
values object

The object dictionary.

Inherited From:
Source:
Returns:
Type
void

shouldStop(instance) → {boolean}

Determines if the clock should stop or not.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
  • Returns true if the clock should stop.
Type
boolean

started(instance) → {void}

This method is called right after clock has started.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void

stopped(instance) → {void}

This method is called right after clock has stopped.

Parameters:
Name Type Description
instance FlipClock

The FlipClock instance.

Source:
Returns:
Type
void