Skip to content
ConcordConcordConcord

Components

Container for registered ComponentClasses

If the concord folder is in the root directory of your game, you can import this module like so:

concord.component = require('concord.components')

Returns true if the container has the ComponentClass with the specified name

boolean = Components.has( name )
Name Type Description
name string Name of the ComponentClass to check
Name Type Description
boolean boolean

Prefix a component’s name with the currently set Reject Prefix

string = Components.reject( name )
Name Type Description
name string Name of the ComponentClass to reject
Name Type Description
string string

Returns true and the ComponentClass if one was registered with the specified name

or false and an error otherwise

boolean = Components.try( name, acceptRejected )
Name Type Description
name string Name of the ComponentClass to check
acceptRejected boolean Whether to accept names prefixed with the Reject Prefix.
Name Type Description
boolean boolean ok
ComponentClass|string componentClass ComponentClass on success, or an error string on failure
string|boolean rejected On success: the stripped Component name if the name had the Reject Prefix, otherwise false

Returns the ComponentClass with the specified name

component = Components.get( name )
Name Type Description
name string Name of the ComponentClass to get
Name Type Description
component ComponentClass