The Class repertoire is merely a small collection of methods to register classes on a global level and have them accessible through a string identifier.
Methods
(p_key) → {function}
GetClassRetrieve the class constructor associated with a given string identifier
Parameters:
Name | Type | Description |
---|---|---|
p_key |
string |
(p_class) → {string}
GetClassKeyRetrieve the string identifier associated with a given class constructor, if any.
If no identifier could be found, but a UID is present in the class provided,
the class will be registered using that UID and its value returned by GetClassKey
.
Parameters:
Name | Type | Description |
---|---|---|
p_class |
function | constructor |
(p_key) → {function}
RemoveClassRemoves the class mapped to a given key
Parameters:
Name | Type | Description |
---|---|---|
p_key |
string |
(p_key, p_class) → {function}
SetClassMap a string identifier to a class constructor.
Parameters:
Name | Type | Description |
---|---|---|
p_key |
string | identifier |
p_class |
function | constructor |
Methods
(p_context, p_key, p_fallback, p_broad)
GetRetrieve the value associated to a given key, within a given context.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
p_context |
function | ||
p_key |
function | Object | ||
p_fallback |
* |
null
|
fallback value in case no existing binding is found |
p_broad |
boolean |
true
|
Whether or not to look for alternative matches |
Examples:
// What's the Ustensil in the Kitchen ?
BINDINGS.Get(Kitchen, Ustensil) == Fork
(p_key, p_binding, p_context)
RemoveParameters:
Name | Type | Description |
---|---|---|
p_key |
* | |
p_binding |
* | |
p_context |
* |
(p_context, p_key, p_binding)
SetRegisters an key-control pair within a given context.
Parameters:
Name | Type | Description |
---|---|---|
p_context |
* | Context where the key:binding will be set |
p_key |
* | key |
p_binding |
* | value to bound to p_key in p_context |
Examples:
// Maps Fork to Ustensil, in the Kitchen context
BINDINGS.Set(Kitchen, Ustensil, Fork)
// The binding can then be retrieved using `Get`
BINDINGS.Get(Kitchen, Ustensil) == Fork
Methods
(p_bindings)
ExpandParameters:
Name | Type | Description |
---|---|---|
p_bindings |
common.helpers.BindingKit |
Examples:
//This is what you'll do most of the time in your module's index.js
BINDINGS.Expand(require(`./my-module-bindings`));