This is stars and forks stats for /nomasystems/nhooks repository. As of 01 May, 2024 this repository has 12 stars and 0 forks.
nhooks Erlang hooks application. It allows adding tasks dynamically to predefined hooks. Status Prerequisites Configuration In your rebar.config file, add the dependency: {deps, [ {nhooks, {git, "[email protected]:nomasystems/nhooks.git", {branch, "main"}}} ]}. Usage example Assuming there is a module named test_app that has one hook named init and another named terminate: -module(test_app). %%% EXTERNAL EXPORTS -export([init/1, terminate/1]). %%% NHOOKS EXPORTS -export([hooks/0]). %%%----------------------------------------------------------------------------- %%% EXTERNAL EXPORTS %%%----------------------------------------------------------------------------- init(Term) -> nhooks:do(?MODULE, init, [Term]). terminate(Term) -> nhooks:do(?MODULE, terminate, [Term]). hooks() -> [ init, terminate ]. You can register tasks to the defined hooks: %%% Registering tasks in both hooks ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term) end). ok = nhooks:register_task(test_app, terminate, fun(Term) -> do_something_else(Term) end). From now on when test_app executes the init and terminate hooks the registered tasks will be executed. You can also register multiple tasks to any defined hook: %%% Registering multiple tasks to same hook ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term) end). ok = nhooks:register_task(test_app, init, fun(Term) -> do_something_else(Term) end). And all will be executed when test_app executes the init hook. If you want to stop the subsequent tasks from executing, you can return stop or {stop, Data} from any task. For example: %%% Stopping subsequent tasks in the same hook ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term), {stop, {some, data}} end). ok = nhooks:register_task(test_app, init, fun(Term) -> do_something_else(Term) end). In this case, the second task won't be executed and the call to nhooks:do/3 will return {stopped, {some, data}}. Support Any doubt or suggestion? Please check out our issue tracker.
nhooks Erlang hooks application. It allows adding tasks dynamically to predefined hooks. Status Prerequisites Configuration In your rebar.config file, add the dependency: {deps, [ {nhooks, {git, "[email protected]:nomasystems/nhooks.git", {branch, "main"}}} ]}. Usage example Assuming there is a module named test_app that has one hook named init and another named terminate: -module(test_app). %%% EXTERNAL EXPORTS -export([init/1, terminate/1]). %%% NHOOKS EXPORTS -export([hooks/0]). %%%----------------------------------------------------------------------------- %%% EXTERNAL EXPORTS %%%----------------------------------------------------------------------------- init(Term) -> nhooks:do(?MODULE, init, [Term]). terminate(Term) -> nhooks:do(?MODULE, terminate, [Term]). hooks() -> [ init, terminate ]. You can register tasks to the defined hooks: %%% Registering tasks in both hooks ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term) end). ok = nhooks:register_task(test_app, terminate, fun(Term) -> do_something_else(Term) end). From now on when test_app executes the init and terminate hooks the registered tasks will be executed. You can also register multiple tasks to any defined hook: %%% Registering multiple tasks to same hook ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term) end). ok = nhooks:register_task(test_app, init, fun(Term) -> do_something_else(Term) end). And all will be executed when test_app executes the init hook. If you want to stop the subsequent tasks from executing, you can return stop or {stop, Data} from any task. For example: %%% Stopping subsequent tasks in the same hook ok = nhooks:register_task(test_app, init, fun(Term) -> do_something(Term), {stop, {some, data}} end). ok = nhooks:register_task(test_app, init, fun(Term) -> do_something_else(Term) end). In this case, the second task won't be executed and the call to nhooks:do/3 will return {stopped, {some, data}}. Support Any doubt or suggestion? Please check out our issue tracker.
repo | techs | stars | weekly | forks | weekly |
---|---|---|---|---|---|
endeve/thornado | FortranTeXPython | 12 | 0 | 11 | 0 |
eddwebster/football_analytics | Jupyter NotebookPython | 1.3k | 0 | 209 | 0 |
ben1234560/AiLearning-Theory-Applying | Jupyter NotebookPython | 2.6k | 0 | 396 | 0 |
binsec/binsec | OCamlPythonC | 282 | 0 | 30 | 0 |
samuelcolvin/pydantic-core | PythonRustOther | 1.1k | 0 | 129 | 0 |
lightrush/framework-laptop-formula | SaltStackPythonShell | 95 | 0 | 7 | 0 |
scalapb/ScalaPB | ScalaHTMLJavaScript | 1.3k | +1 | 276 | +1 |
t4sk/defi-by-example | SolidityJavaScriptPython | 531 | 0 | 220 | 0 |
IntelRealSense/realsense-ros | PythonC++CMake | 2.2k | 0 | 1.6k | 0 |
pixie-io/pixie | C++GoTypeScript | 4.9k | 0 | 383 | 0 |