Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@poppinss/hooks

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poppinss/hooks - npm Package Compare versions

Comparing version 7.1.1-5 to 7.1.1-6

4

build/src/runner.d.ts

@@ -31,2 +31,6 @@ import { HookHandler, HookHandlerProvider } from './types.js';

/**
* Execute handlers in reverse order
*/
runReverse(...data: HookArgs): Promise<void>;
/**
* Execute cleanup actions

@@ -33,0 +37,0 @@ */

22

build/src/runner.js

@@ -75,5 +75,5 @@ /*

/**
* Execute handlers
* Executing hooks
*/
async run(...data) {
async #exec(reverse, data) {
if (this.#state !== 'idle') {

@@ -86,6 +86,4 @@ return;

}
/**
* Execute handlers
*/
for (let handler of this.#hookHandlers) {
const handlers = reverse ? Array.from(this.#hookHandlers).reverse() : this.#hookHandlers;
for (let handler of handlers) {
if (this.#filter(handler.name)) {

@@ -102,2 +100,14 @@ const result = await (typeof handler === 'function'

/**
* Execute handlers
*/
async run(...data) {
return this.#exec(false, data);
}
/**
* Execute handlers in reverse order
*/
async runReverse(...data) {
return this.#exec(true, data);
}
/**
* Execute cleanup actions

@@ -104,0 +114,0 @@ */

{
"name": "@poppinss/hooks",
"version": "7.1.1-5",
"version": "7.1.1-6",
"description": "A no brainer hooks module for execute before/after lifecycle hooks",

@@ -44,3 +44,3 @@ "main": "build/index.js",

"@adonisjs/tsconfig": "^1.1.8",
"@commitlint/cli": "^17.7.1",
"@commitlint/cli": "^17.7.2",
"@commitlint/config-conventional": "^17.7.0",

@@ -51,6 +51,6 @@ "@japa/assert": "^2.0.0-1",

"@swc/core": "1.3.82",
"@types/node": "^20.6.3",
"@types/node": "^20.8.3",
"c8": "^8.0.1",
"del-cli": "^5.1.0",
"eslint": "^8.50.0",
"eslint": "^8.51.0",
"github-label-sync": "^2.3.1",

@@ -57,0 +57,0 @@ "husky": "^8.0.3",

@@ -75,2 +75,11 @@ # @poppinss/hooks

To run hooks in the reverse order, you can use the `runner.runReverse` method.
```ts
const hooks = new Hooks()
const runner = hooks.runner('saving')
await runner.runReverse()
```
### Passing data to hooks

@@ -77,0 +86,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc