From bc5556ca5344b72d54cdc1a06483adaab58eea9e Mon Sep 17 00:00:00 2001 From: Jared Wray Date: Tue, 15 Oct 2024 12:58:43 -0700 Subject: [PATCH] Update README.md --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4b6c75..655f7d1 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ if you are not using ESM modules, you can use the following: ``` -# API +# API - Hooks ## .onHook(eventName, handler) @@ -143,6 +143,8 @@ Get all hooks for an event. ## .clearHooks(eventName) +# API - Events + ## .on(eventName, handler) Subscribe to an event. @@ -167,6 +169,30 @@ Remove all listeners for an event. Set the maximum number of listeners and will truncate if there are already too many. +## .once(eventName, handler) + +Subscribe to an event once. + +## .prependListener(eventName, handler) + +Prepend a listener to an event. + +## .prependOnceListener(eventName, handler) + +Prepend a listener to an event once. + +## .eventNames() + +Get all event names. + +## .listenerCount(eventName?) + +Get the count of listeners for an event or all events if evenName not provided. + +## .rawListeners(eventName?) + +Get all listeners for an event or all events if evenName not provided. + # Development and Testing Hookified is written in TypeScript and tests are written in `vitest`. To run the tests, use the following command: