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

@sugarch/bc-mod-hook-manager

v0.3.4

Published

A mod hooks manager base on bcmodsdk

Readme

@sugarch/bc-mod-hook-manager

A package that wraps the bcModSdk to provide a more flexible hook mechanism. It simplifies the creation and management of mods by offering a loose coupling of hooks and utilities.

Installation

To install the package, use:

# Using pnpm
pnpm add @sugarch/bc-mod-hook-manager

# Using yarn
yarn add @sugarch/bc-mod-hook-manager

# Using npm
npm install @sugarch/bc-mod-hook-manager

Usage

Initialize

To initialize the hook manager, you need to provide the mod information. You can either pass the mod information directly or use the registered mod from the bcModSdk.

import { HookManager } from '@sugarch/bc-mod-hook-manager';

const mod = bcModSdk.registerMod({
  name: 'MyMod',
  fullName: 'My Mod',
  version: '1.0.0',
  repository: 'https://github.com/username/repo',
});

// Initialize the hook manager with a registered mod
HookManager.initWithMod(mod);

hookFunction

The hookFunction method allows you to register hooks, and can be executed before the mod initialization. This is useful for setting up necessary hooks early in the mod lifecycle.

import { HookManager } from '@sugarch/bc-mod-hook-manager';

// Register a hook function
HookManager.hookFunction('SomeFunction', 1, (args, next) => {
  console.log('Hook before SomeFunction');
  next(args);
});

const bcmod = bcModSdk.registerMod(...);

// initialize the mod after registering the hook, then the hook will be executed
HookManager.initWithMod(bcmod);

afterInit

The afterInit method lets you add callbacks that will be executed after the mod has been initialized. Which means all the hooks registered before initWithMod will be executed before the callback.

If the mod is already initialized, the callback will be executed immediately.

import { HookManager } from '@sugarch/bc-mod-hook-manager';

// Add a callback to be executed after initialization
HookManager.afterInit(() => {
  console.log('Mod has been initialized');
});

afterPlayerLogin

The afterPlayerLogin method allows you to add callbacks that will be executed after the player logs in. If the player is already logged in, the callback will be executed immediately. The callback will not be invoked when the player is disconnected and reconnected.

import { HookManager } from '@sugarch/bc-mod-hook-manager';

// Add a callback to be executed after player login
HookManager.afterPlayerLogin(() => {
  console.log('Player has logged in');
});

progressiveHook

The progressiveHook method allows you to assemble hooks in a chain-like manner. This allows for more complex and flexible hook management by combining multiple hook functions into a single progressive hook.

import { HookManager } from '@sugarch/bc-mod-hook-manager';

// Create a progressive hook (priority is optional parameter)
const hook = HookManager.progressiveHook('SomeFunction');

// Add steps to the progressive hook
hook
  // inject step will not set the return value
  .inject((args, next) => {
    console.log('Inject step');
  })
  // override step will set the return value
  .override((args, next) => {
    console.log('Override step');
    return next(args);
  });
// if a chain does not set the return value, the original function will be called after the last step