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
GetClass(p_key) → {function}
Retrieve the class constructor associated with a given string identifier
Parameters:
| Name | Type | Description | 
|---|---|---|
| p_key | string | 
GetClassKey(p_class) → {string}
Retrieve 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 | 
RemoveClass(p_key) → {function}
Removes the class mapped to a given key
Parameters:
| Name | Type | Description | 
|---|---|---|
| p_key | string | 
SetClass(p_key, p_class) → {function}
Map a string identifier to a class constructor.
Parameters:
| Name | Type | Description | 
|---|---|---|
| p_key | string | identifier | 
| p_class | function | constructor | 
Methods
Get(p_context, p_key, p_fallback, p_broad)
Retrieve 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) == ForkRemove(p_key, p_binding, p_context)
Parameters:
| Name | Type | Description | 
|---|---|---|
| p_key | * | |
| p_binding | * | |
| p_context | * | 
Set(p_context, p_key, p_binding)
Registers 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) == ForkMethods
Expand(p_bindings)
Parameters:
| 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`));