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 c423d9c commit 49ed6ed
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Features
- Emit Events via [Emittery](https://npmjs.com/package/emittery)
- Middleware Hooks with data passing
- Async Middleware Hooks for Your Methods
- ESM and Nodejs 20+
- Maintained on a regular basis!

Expand All @@ -33,7 +33,7 @@ class MyClass extends Hookified {
}

async myMethodEmittingEvent() {
await this.emit('message', 'Hello World');
await this.emit('message', 'Hello World'); //using Emittery
}

//with hooks you can pass data in and if they are subscribed via onHook they can modify the data
Expand Down Expand Up @@ -70,6 +70,30 @@ class MyClass extends Hookified {

## API

Please see the [Emittery](https://npmjs.com/package/emittery) documentation for more information on the event emitter.

### .onHook(eventName, handler)

Subscribe to a hook event.

### .removeHook(eventName)

Unsubscribe from a hook event.

### .hook(eventName, ...args)

Run a hook event.

### .hooks

Get all hooks.

### .getHooks(eventName)

Get all hooks for an event.

### .clearHooks(eventName)

## Development and Testing

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

0 comments on commit 49ed6ed

Please sign in to comment.