registry.js

Summary
registry.js
bbop.registryBBOP generic lightweight listener/callback registry system.
Functions
registryContructor for BBOP registry.
registerAdd the specified function from the registry, with an optional relative priority against other callback functions.
is_registeredReturns whether or not an id has already been registered to a category.
unregisterRemove the specified function from the registry.
get_callbacksGeneric getter for callback functions, returns by priority.
apply_callbacksGeneric runner for prioritized callbacks with various arguments and an optional change in context..

bbop.registry

BBOP generic lightweight listener/callback registry system.

Summary
Functions
registryContructor for BBOP registry.
registerAdd the specified function from the registry, with an optional relative priority against other callback functions.
is_registeredReturns whether or not an id has already been registered to a category.
unregisterRemove the specified function from the registry.
get_callbacksGeneric getter for callback functions, returns by priority.
apply_callbacksGeneric runner for prioritized callbacks with various arguments and an optional change in context..

Functions

registry

bbop.registry = function(evt_list)

Contructor for BBOP registry.  Takes a list of event categories as strings.

Arguments

evt_lista list of strings that identify the events to be used

Returns

bbop registry object

register

this.register = function(category,
function_id,
in_function,
in_priority)

Add the specified function from the registry, with an optional relative priority against other callback functions.

The in_priority value is relative to others in the category, with a higher priority...getting priority.

Parameters

categorystring; one of the pre-defined categories
function_idstring; a unique string to identify a function
in_functionfunction
in_priority[optional] number

Returns

n/a

See also

<apply>

is_registered

this.is_registered = function(category,
function_id)

Returns whether or not an id has already been registered to a category.  Will return null if the category does not exist.

Parameters

categorystring; one of the pre-defined categories
function_idstring; a unique string to identify a function

Returns

true, false, or null

unregister

this.unregister = function(category,
function_id)

Remove the specified function from the registry.  Must specify a legitimate category and the function id of the function in it.

Parameters

categorystring
function_idstring

Returns

boolean on whether something was unregistered

get_callbacks

this.get_callbacks = function(category)

Generic getter for callback functions, returns by priority.

Parameters

categorystring

Returns

an ordered (by priority) list of function_id strings

apply_callbacks

this.apply_callbacks = function(category,
arg_list,
context)

Generic runner for prioritized callbacks with various arguments and an optional change in context..

Parameters

categorystring
arg_lista list of arguments to pass to the function in the category
context[optional] the context to apply the arguments in

Returns

n/a

bbop.registry = function(evt_list)
Contructor for BBOP registry.
this.register = function(category,
function_id,
in_function,
in_priority)
Add the specified function from the registry, with an optional relative priority against other callback functions.
this.is_registered = function(category,
function_id)
Returns whether or not an id has already been registered to a category.
this.unregister = function(category,
function_id)
Remove the specified function from the registry.
this.get_callbacks = function(category)
Generic getter for callback functions, returns by priority.
this.apply_callbacks = function(category,
arg_list,
context)
Generic runner for prioritized callbacks with various arguments and an optional change in context..
Close