npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hooksie

v0.0.5

Published

Lightweight communication system that combines the simplicity of events and control of observables.

Downloads

121

Readme

Hooksie

Hooksie is a lightweight communication system that combines the simplicity of events and control of observables.

Features

  • "Scopes" to group hooks in a specific part of the code
  • Callbacks ordering
  • Hooks monitoring & debug tools
  • All callbacks for a hook guaranteed to be called, even if one fails

Getting started

Install the package:

npm i hooksie

Example script:

import Hooksie from 'hooksie';

// Create a new scope, which contains hooks
const scope = Hooksie.scope('demoScope');

// Create hooks with specific type argument (TypeScript)
const sendInfoHook = scope.hook<string>('sendInfo');
const updateScoreHook = scope.hook<number>('updateScore');

// Example callback for the "sendInfo" hook
function handleSendInfo(info: string) {
  console.log('Send info:', info);
}

// Example callback for the "updateScore" hook
function handleUpdateScore(info: number) {
  console.log('Update score:', info);
}

// Use fasten() function to register callbacks
const sendInfoHandle = sendInfoHook.fasten(handleSendInfo);
updateScoreHook.fasten(handleUpdateScore);

// Invoke hook callbacks
sendInfoHook.invoke('info');
updateScoreHook.invoke(100);

// Detach a callback using its handle
sendInfoHandle.detach();
// Detach a callback directly from a hook
updateScoreHook.detach(handleUpdateScore);

Documentation

Naming

  • Hook: a named communication channel (you could call it an event) to which callbacks can be attached
  • Scope: a group of Hooks. You can use scopes to organize and encapsulate hooks in specific parts of your code

API

Types

type HookCallback<T> = ((arg: T) => any) | ((arg: T) => Promise<any>);

Hooksie

  • static scope(name?: string): HookScope: Create a new scope
  • static hook<T>(name: string): Hook<T>: Create a new hook in the default scope
  • static fasten<T, U extends HookCallback<T>>(hookName: string, callback: U, order?: number): HookHandle<T>: Register a callback to a named hook in the default scope
  • static detach<T, U extends HookCallback<T>>(callback: U): boolean: Remove a callback from all hooks in the default scope
  • static detach<T, U extends HookCallback<T>>(hookName: string, callback: U): boolean: Remove a callback from the named hook in the default scope

HooksScope

  • get name(): string | undefined: Get the name of this scope
  • hook<T>(name?: string): Hook<T>: Create a new hook in this scope
  • fasten<T, U extends HookCallback<T>>(callback: U, order?: number): HookHandle<T>: Register a callback to a named hook in this scope
  • detach<T, U extends HookCallback<T>>(callback: U): boolean: Remove a callback from all hooks in this scope
  • detach<T, U extends HookCallback<T>>(hookName: string, callback: U): boolean: Remove a callback from the named hook in this scope

Hook<T>

  • get name(): string: Get the name of this hook
  • fasten<U extends HookCallback<T>>(callback: U, order?: number): HookHandle<T>: Register a callback to this hook
  • detach<U extends HookCallback<T>>(callback: U): boolean: Remove a callback from this hook
  • invoke(arg: T): Promise<boolean>: Invoke all the callbacks in this hook, and returns true if all the callbacks have been called successfully
  • invokeSync(arg: T): boolean: Invoke all the callbacks in this hook, and returns true if all the callbacks have been called successfully

HookHandle<T>

  • get id(): number: Get the unique id of this handle
  • get isAsync(): boolean: Check if the related callback is an async function
  • get order(): number: Get the order value of the related callback in its owning hook.
  • set order(order: number): Set the order value of the related callback in its owning hook. The lower the value, the first.

Get Help

If you need help or just want to chat with the community and the Sideways Experiments core team, you're welcome to join our Discord server!

Contributing

Do you want to get involved in our projects? Check the CONTRIBUTING.md file to learn more!

License

This project is licensed under the MIT License.


Crafted and maintained with love by Sideways Experiments

(c) 2022-2025 Sideways Experiments