Reacher
Reacher is light-weight request-value bus.
Dependencies
None.
Installation
- Clone this repository; or
- Download the
dist/reacher.js
; or bower install reacher
; ornpm install reacher
Sample usage
var reacherBus = ; reacherBus; var val = reacherBus; // 41
or construct in node
var reacherBus = ;// ...
API
{void} handle(command, callable)
Register a command handler for given command name. Only 1 command handler is permitted at any given time.
throws ReacherError when command handler already set. throws ReacherError when command handler is not a function.
{*} request(command, ...args)
Request a command value by name and with optional arguments passed on to handler.
throws ReacherError when handler does not exist.
{function} removeHandler(command)
Remove a command handler from registry and return the handler function.
throws ReacherError when command handler does not exist.
{boolean} hasHandler(command)
Determine whether the handler is set for given command name.
License
Licensed under terms and conditions of Apache 2.0 license.