Comparing version 1.1.0 to 1.2.0
@@ -49,10 +49,2 @@ // src/eventified.ts | ||
} | ||
} else if (event === "error") { | ||
if (arguments_[0] instanceof Error) { | ||
throw arguments_[0]; | ||
} else { | ||
const error = new CustomEventError(arguments_[0]); | ||
error.context = arguments_[0]; | ||
throw error; | ||
} | ||
} | ||
@@ -82,13 +74,2 @@ } | ||
}; | ||
var CustomEventError = class _CustomEventError extends Error { | ||
context; | ||
constructor(message, context) { | ||
super(message); | ||
this.context = context; | ||
if (Error.captureStackTrace) { | ||
Error.captureStackTrace(this, _CustomEventError); | ||
} | ||
this.name = this.constructor.name; | ||
} | ||
}; | ||
@@ -95,0 +76,0 @@ // src/index.ts |
{ | ||
"name": "hookified", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Event and Middleware Hooks", | ||
@@ -29,3 +29,2 @@ "type": "module", | ||
"hooks", | ||
"emittery", | ||
"eventemitter", | ||
@@ -41,3 +40,2 @@ "eventemitter3", | ||
"hook-handlers", | ||
"async-hooks", | ||
"middleware", | ||
@@ -64,3 +62,3 @@ "emit", | ||
"@vitest/coverage-v8": "^2.1.1", | ||
"docula": "^0.9.0", | ||
"docula": "^0.9.1", | ||
"rimraf": "^6.0.1", | ||
@@ -67,0 +65,0 @@ "tsup": "^8.3.0", |
<img src="site/logo.svg" alt="Hookified" height="400" align="center"> | ||
# Async Event and Middleware Hooks | ||
# Event Emitting and Async Middleware Hooks | ||
@@ -14,3 +14,3 @@ [![tests](https://github.com/jaredwray/hookified/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/hookified/actions/workflows/tests.yaml) | ||
- Async Middleware Hooks for Your Methods | ||
- ESM / CJS and Nodejs 20+ | ||
- ESM / CJS with Types and Nodejs 20+ | ||
- Maintained on a regular basis! | ||
@@ -24,3 +24,3 @@ | ||
## Usage | ||
This was built because we constantly wanted hooks and events extended on libraires we are building such as [Keyv](https://keyv.org) and [Cacheable](https://cacheable.org). This is a simple way to add hooks and events (via [emittery](https://npmjs.com/package/emittery)) to your libraries. | ||
This was built because we constantly wanted hooks and events extended on libraires we are building such as [Keyv](https://keyv.org) and [Cacheable](https://cacheable.org). This is a simple way to add hooks and events to your classes. | ||
@@ -36,3 +36,3 @@ ```javascript | ||
async myMethodEmittingEvent() { | ||
await this.emit('message', 'Hello World'); //using Emittery | ||
this.emit('message', 'Hello World'); //using Emittery | ||
} | ||
@@ -39,0 +39,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15963
305