ARCS logo.js Augmented Reality Component System

Class: Component

Component

new Component()

Defines main traits of components in a namespace regrouping important methods

Members

<static> SourceIsNotComponent

Error message

<static> UndefinedSignal

Error message

<static> UndefinedSlot

Error message

Methods

<static> check(name)

Checks if the given prototype has traits of a component
Parameters:
Name Type Description
name string name of the prototype
To Do:
  • we need to check if this is used and refactor this method

<static> config(component, obj)

Specific hook that can be called when initializing a component
Parameters:
Name Type Description
component object prototype of the component
obj object the actual object

<static> connect(source, signal, destination, slt)

Connects two different components by using their signal and slots
Parameters:
Name Type Description
source object component sending data
signal string name of the signal to connect
destination object component receiving data
slt string name of the slot to connect

<static> create(name, sltList, sgnList)

External constructor: give component traits to any constructor. Component traits are the following:
  • Slot functions listed in an array;
  • A signal list described in an array;
  • A method returning the slot list;
  • A method returnung the signal list;
  • An emit method, to trigger signals by their names;
  • A slot method to cast an internal method to a slot;
  • A signal method to register a possible signal.
Parameters:
Name Type Description
name string Class name to transform to a component
sltList Array.<string> names of functions designated as slots, may be empty.
sgnList Array.<string> names of functions designated as signals, may be empty.

<static> disconnect(source, signal, destination, slt)

Diconnects a signal/slot connection between two components
Parameters:
Name Type Description
source object component sending data
signal string name of the signal to connect
destination object component receiving data
slt string name of the slot to connect

<static> invoke(destination, slt, value)

Invokes a specific slot of a given component
Parameters:
Name Type Description
destination object component upon which invocation is performed
slt string name of the slot to invoke
value mixed value to input

<static> signal(signal)

Adds one or more global signals.
Parameters:
Name Type Description
signal String | Array.String name or names of the signals to create

<static> slot(slot, func)

Adds one or more global slots. This method has two different behaviours. The first one is equivalent to Component#slot except the defined slot is global. The second one tags some methods of the components as slots just by giving their names.
Parameters:
Name Type Attributes Description
slot String | Array.String name or names of the slots to create
func function <optional>
callback function that will be used as a slot

<static> slotList() → {Array.String}

Gives the list of global slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

<static> slotList() → {Array.String}

Gives the list of global slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

emit(signal, params)

Emits a signal
Parameters:
Name Type Attributes Description
signal String name of the signal to emit
params * <optional>
<repeatable>
zero or more params to pass to the signal

signal(slot)

Creates a signal that is only owned by this component instance. Please notice, that when this method is called, the list of global signals will be separated from the local one. Newer global signals will then not be added to the component instance.
Parameters:
Name Type Description
slot String name of the signal to create

slot(slot, func)

Creates a slot that is only owned by this component instance. You can see an example of such use in component StateMachine Please notice, that when this method is called, the list of global slots will be separated from the local one. Newer global slots will then not be added to the component instance. In case the slot is already existing, a call to this function will replace the slot.
Parameters:
Name Type Description
slot String name of the slot to create
func function callback function that will be used as a slot

slotList() → {Array.String}

Gives the list of local slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

slotList() → {Array.String}

Gives the list of local slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

Component

new Component()

Error message

Members

<static> SourceIsNotComponent

Error message

<static> UndefinedSignal

Error message

<static> UndefinedSlot

Error message

Methods

<static> check(name)

Checks if the given prototype has traits of a component
Parameters:
Name Type Description
name string name of the prototype
To Do:
  • we need to check if this is used and refactor this method

<static> config(component, obj)

Specific hook that can be called when initializing a component
Parameters:
Name Type Description
component object prototype of the component
obj object the actual object

<static> connect(source, signal, destination, slt)

Connects two different components by using their signal and slots
Parameters:
Name Type Description
source object component sending data
signal string name of the signal to connect
destination object component receiving data
slt string name of the slot to connect

<static> create(name, sltList, sgnList)

External constructor: give component traits to any constructor. Component traits are the following:
  • Slot functions listed in an array;
  • A signal list described in an array;
  • A method returning the slot list;
  • A method returnung the signal list;
  • An emit method, to trigger signals by their names;
  • A slot method to cast an internal method to a slot;
  • A signal method to register a possible signal.
Parameters:
Name Type Description
name string Class name to transform to a component
sltList Array.<string> names of functions designated as slots, may be empty.
sgnList Array.<string> names of functions designated as signals, may be empty.

<static> disconnect(source, signal, destination, slt)

Diconnects a signal/slot connection between two components
Parameters:
Name Type Description
source object component sending data
signal string name of the signal to connect
destination object component receiving data
slt string name of the slot to connect

<static> invoke(destination, slt, value)

Invokes a specific slot of a given component
Parameters:
Name Type Description
destination object component upon which invocation is performed
slt string name of the slot to invoke
value mixed value to input

<static> signal(signal)

Adds one or more global signals.
Parameters:
Name Type Description
signal String | Array.String name or names of the signals to create

<static> slot(slot, func)

Adds one or more global slots. This method has two different behaviours. The first one is equivalent to Component#slot except the defined slot is global. The second one tags some methods of the components as slots just by giving their names.
Parameters:
Name Type Attributes Description
slot String | Array.String name or names of the slots to create
func function <optional>
callback function that will be used as a slot

<static> slotList() → {Array.String}

Gives the list of global slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

<static> slotList() → {Array.String}

Gives the list of global slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

emit(signal, params)

Emits a signal
Parameters:
Name Type Attributes Description
signal String name of the signal to emit
params * <optional>
<repeatable>
zero or more params to pass to the signal

signal(slot)

Creates a signal that is only owned by this component instance. Please notice, that when this method is called, the list of global signals will be separated from the local one. Newer global signals will then not be added to the component instance.
Parameters:
Name Type Description
slot String name of the signal to create

slot(slot, func)

Creates a slot that is only owned by this component instance. You can see an example of such use in component StateMachine Please notice, that when this method is called, the list of global slots will be separated from the local one. Newer global slots will then not be added to the component instance. In case the slot is already existing, a call to this function will replace the slot.
Parameters:
Name Type Description
slot String name of the slot to create
func function callback function that will be used as a slot

slotList() → {Array.String}

Gives the list of local slot names for a given type of component
Returns:
list of global slot names
Type
Array.String

slotList() → {Array.String}

Gives the list of local slot names for a given type of component
Returns:
list of global slot names
Type
Array.String