Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Sep 6, 2024
1 parent fa775cf commit dc4f422
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="site/logo.svg" alt="Hookified" height="400" align="center">

# Event and Middleware Hooks for Your Libraries
# Async Event and Middleware Hooks

[![tests](https://github.com/jaredwray/hookified/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/hookified/actions/workflows/tests.yaml)
[![GitHub license](https://img.shields.io/github/license/jaredwray/hookified)](https://github.com/jaredwray/hookified/blob/master/LICENSE)
Expand All @@ -14,6 +14,8 @@
- ESM and Nodejs 20+
- Maintained on a regular basis!

Special thanks to [@sindresorhus](https://github.com/sindresorhus) for the [Emittery](https://npmjs.com/package/emittery) library. 🍻

## Installation
```bash
npm install hookified --save
Expand Down Expand Up @@ -43,5 +45,47 @@ class MyClass extends Hookified {
return data;
}
}
```

You can even pass in multiple arguments to the hooks:

```javascript
import { Hookified } from 'hookified';

class MyClass extends Hookified {
constructor() {
super();
}

async myMethodWithHooks() Promise<any> {
let data = { some: 'data' };
let data2 = { some: 'data2' };
// do something
await this.hook('before:myMethod2', data, data2);

return data;
}
}
```

## API

## Development and Testing

Hookified is written in TypeScript and tests are written in `vitest`. To run the tests, use the following command:

To setup the environment and run the tests:

```bash
npm i && npm test
```

To contribute follow the [Contributing Guidelines](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).

## License

[MIT & © Jared Wray](LICENSE)




0 comments on commit dc4f422

Please sign in to comment.