DEV Community

Cover image for Uncino 🪝 Fast, tiny and solid hooks system for Javascript and NodeJS
Riccardo Tartaglia
Riccardo Tartaglia

Posted on • Updated on

Uncino 🪝 Fast, tiny and solid hooks system for Javascript and NodeJS

Uncino is italian word for hook

See on Github

Do you know Wordpress hooks system? Uncino is a hooks system highly inspired to it!

  • Async / Await support
  • Node or Browser support
  • Actions / Hooks system
  • Easy to use
  • No Dependencies

Philosophy

Uncino permit to your code to interact/modify another piece of code at specific, pre-defined spots.

Uncino has two types of hooks: Actions and Hooks. To use either, you need to write a custom function, and then register for a specific action or hook.

Actions allow you to add data or change how your code operates. Actions will run at a specific point in the execution. Callback functions for Actions can perform some kind of a task, like echoing output to the user or inserting something into the database. Callback functions for an Action do not return anything back to the calling Action hook.

Hooks give you the ability to change data during the execution of your code. Callback functions for Filters will accept a variable, modify it, and return it. They are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. Filters expect to have something returned back to them.

With Uncino you can create your own hook spots so that other developers can extend and modify your code or you can create your pluggable core.

Pull Requests?

I'd love them!

Comments?

Let's hear them! (The nice ones please!)

Me?

In case you're interested I'm @riktarweb

Top comments (1)

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

Hey, It may be a great idea, will you add a post to showcase? 😁