Class: AbstractHostFeature

(abstract) AbstractHostFeature(host)

Base class for all host features. Keeps a reference to the host object managing
the feature.

Constructor

(abstract) new AbstractHostFeature(host)

Parameters:
Name Type Description
host core/HostObject

The HostObject managing the feature.

Properties:
Name Type Description
EVENTS Object

Built-in messages that the feature emits. When the
feature is added to a core/HostObject, event names will be prefixed by the
name of the feature class + '.'.

Properties
Name Type Attributes Default Description
update string <optional>
onUpdate

Message that is emitted after
each call to update.

SERVICES Object

Any AWS services that are necessary for the
feature to function.

Members

(readonly) host

Gets the host that manages the feature.

(readonly) owner

Gets the engine owner object of the host.

Methods

(static) emit(message, valueopt)

Emit feature messages from the global messenger. Feature messages will be prefixed
with the class name of the feature.

Parameters:
Name Type Attributes Description
message string

The message to emit.

value any <optional>

Optional parameter to pass to listener callbacks.

(static) listenTo(message, callback)

Listen to a feature message from the global messenger. Feature messages will
be prefixed with the class name of the feature.

Parameters:
Name Type Description
message string

Message to listen for.

callback function

The callback to execute when the message is received.

(static) mix(…mixinClassFactories) → {Class}

Applies a sequence of mixin class factory functions to this class and
returns the result. Each function is expected to return a class that
extends the class it was given. The functions are applied in the order
that parameters are given, meaning that the first factory will
extend this base class.

Parameters:
Name Type Attributes Description
mixinClassFactories function <repeatable>

Class factory functions that will
be applied.

Returns:

A class that is the result of applying the factory functions.
The resulting class will always inherit from AbstractHostFeature.

Type
Class

(static) stopListening(message, callbackopt)

Stop listening to a message from the global messenger.

Parameters:
Name Type Attributes Description
message string

Message to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

(static) stopListeningByRegexp(regexp, callbackopt)

Stop listening to a message matching the given regular expression from the
global messenger.

Parameters:
Name Type Attributes Description
regexp Regexp

The regular expression to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

(static) stopListeningToAll()

Stop listening to all feature messages.

discard()

Clean up once the feature is no longer in use. Remove the feature namespace
from the host and remove reference to the host.

emit(message, valueopt)

Emit feature messages from the host. Feature messages will be prefixed with
the class name of the feature.

Parameters:
Name Type Attributes Description
message string

The message to emit.

value any <optional>

Optional parameter to pass to listener callbacks.

installApi()

Adds a namespace to the host with the name of the feature to contain properties
and methods from the feature that users of the host need access to.

listenTo(message, callback)

Listen to a feature message from the host object.

Parameters:
Name Type Description
message string

Message to listen for.

callback function

The callback to execute when the message is received.

stopListening(message, callbackopt)

Stop listening to a message from the host object.

Parameters:
Name Type Attributes Description
message string

Message to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

stopListeningByRegexp(regexp, callbackopt)

Stop listening to a message matching the given regular expression from the
host object.

Parameters:
Name Type Attributes Description
regexp Regexp

The regular expression to stop listening for.

callback function <optional>

Optional callback to remove. If none is defined,
remove all callbacks for the message.

stopListeningToAll()

Stop listening to all messages.

update(deltaTime)

Executes each time the host is updated.

Parameters:
Name Type Description
deltaTime number

Amount of time since the last host update was
called.