/hookJS

A javascript based hook system.

Primary LanguageJavaScript

hookJS is a very simple library that allows a developer to call "hooks", hooks being a nice way of organizing one to many anonymous functions as well as linking events to functions.

A great use case is a javascript video game controller where you have directional states. Up, down, left, and right would all have hooks that would have functions attached to them.

Here is some example code...

hook.add('example', function (foo, bar) {
  console.log('example hook ran');
  console.log(foo, 'foo');
  console.log(bar, 'bar');
});
hook.call('example', 'test', 'test2');