Namespace BTM.Mapping
CSS Selector Based function mappings
Defined in: mapping.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
BTM.Mapping.callbacks
The Array containing the functions to run
|
| <static> |
BTM.Mapping.mappingsHaveRun
Flag to indicate if mappings have been run for the page
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
BTM.Mapping.add(selector, callback, initOrder)
Add an entry for a function to run on specified elements
|
| <static> |
BTM.Mapping.init(container)
Run the Mappings.
|
| <static> |
BTM.Mapping.remove(selector, index, initOrder)
Remove an entry from the Mappings Array
|
Field Detail
<static>
BTM.Mapping.callbacks
The Array containing the functions to run
<static>
BTM.Mapping.mappingsHaveRun
Flag to indicate if mappings have been run for the page
Method Detail
<static>
{Number}
BTM.Mapping.add(selector, callback, initOrder)
Add an entry for a function to run on specified elements
- Parameters:
- {String} selector
- the CSS selector string representing the target Elements
- {Function} callback
- the Function to call for each Element. The target Element will be passed as the first argument to the Function
- {Number} initOrder Optional, Default: 5
- the "run-level" for this Mapping, lower levels run earlier.
- Returns:
- {Number} the index where the new Mapping was created. This (along with the selector String) can be used to refer to the Mapping later, e.g. to remove it
<static>
{Number}
BTM.Mapping.init(container)
Run the Mappings. If the BTM option "runMappings" is set to false, this will return false and not run
- Parameters:
- {HTMLElement|String} container Optional, Default: document.body
- element ID or element reference to use as the base when selecting target Elements
- Returns:
- {Number} time taken to run all Mappings
<static>
{Function|Boolean}
BTM.Mapping.remove(selector, index, initOrder)
Remove an entry from the Mappings Array
- Parameters:
- {String} selector
- the CSS selector string representing the target Elements
- {Number} index
- the index of the Function in the Array. This is the value returned by @link{BTM.Mapping.add}
- {Number} initOrder Optional, Default: 5
- the "run-level" to remove the Mapping from
- Returns:
- {Function|Boolean} the Function that has been removed from the Mappings Array, or false if not found