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

wiznetic-kernel-js-front-end

v1.0.0

Published

Programmable lifecycle microkernel for the frontend by Wiznetic

Readme

wiznetic-kernel-js-front-end

Programmable lifecycle microkernel for the frontend by Wiznetic.

Frontend mirror of wiznetic/kernel (PHP).


Installation

npm install wiznetic-kernel-js-front-end

Lifecycle

The kernel runs three ordered steps on boot:

| Step | Purpose | |---------|--------------------------------| | init | Early setup, service bootstrap | | ready | DOM work, component init | | done | Finalization, cleanup |

Each step has three phases: before → on → after.


Usage

Boot

Call Kernel.boot() once from your entry file. It waits for the DOM automatically.

import { Kernel } from 'wiznetic-kernel-js-front-end'

Kernel.boot()

Lifecycle hooks

import { Kernel } from 'wiznetic-kernel-js-front-end'

Kernel.on('ready', async (ctx) => {
    console.log('DOM is ready')
})

Kernel.before('ready', async (ctx) => {
    // runs before 'on:ready'
})

Kernel.after('done', async (ctx) => {
    // runs after everything
})

Custom events

Define an event class:

import { Event } from 'wiznetic-kernel-js-front-end'

export class UserLoggedIn extends Event {
    constructor(user) {
        super()
        this.user = user
    }
}

Listen and dispatch:

import { Kernel }      from 'wiznetic-kernel-js-front-end'
import { UserLoggedIn } from './events/UserLoggedIn.js'

// Register listener
Kernel.listen(UserLoggedIn, async (event) => {
    console.log('User:', event.user)
})

// Dispatch
await Kernel.dispatch(new UserLoggedIn({ id: 1, name: 'John' }))

Stop propagation:

Kernel.listen(UserLoggedIn, async (event) => {
    event.stopPropagation() // next listeners won't run
})

Listing — bind event listener to lifecycle step

import { Kernel }      from 'wiznetic-kernel-js-front-end'
import { UserLoggedIn } from './events/UserLoggedIn.js'
import { AuthHandler }  from './handlers/AuthHandler.js'

Kernel.listen(UserLoggedIn, AuthHandler)
      .on('ready')              // run AuthHandler when UserLoggedIn is dispatched, during on:ready
      .after('done')            // also run after done

Receive modes:

.on('ready', 'event')          // handler receives only the event
.on('ready', 'ctx')            // handler receives only the context
.on('ready', 'all')            // handler receives (ctx, event) — default
.on('ready', (ctx, e) => [e])  // custom resolver

Context

The ctx object is available in all hooks and carries shared data across the lifecycle:

Kernel.on('init', async (ctx) => {
    ctx.data.set('user', { id: 1 })
})

Kernel.on('ready', async (ctx) => {
    const user = ctx.data.get('user')
})

Trace

Enable timing records for debugging:

Kernel.trace(true)

await Kernel.boot()

console.log(Kernel.getTrace())
// [{ phase, step, handler, duration (ms), at }]

API Reference

Kernel

| Method | Description | |--------|-------------| | Kernel.boot() | Start the lifecycle. Waits for DOMContentLoaded. Returns Promise. | | Kernel.before(step, cb) | Register hook before a step | | Kernel.on(step, cb) | Register hook on a step | | Kernel.after(step, cb) | Register hook after a step | | Kernel.listen(EventClass, handler) | Register event listener. Returns Listing. | | Kernel.dispatch(event) | Dispatch an event. Returns Promise. | | Kernel.trace(enabled) | Enable/disable trace recording | | Kernel.getTrace() | Get recorded trace entries |

Event

| Method | Description | |--------|-------------| | event.stopPropagation() | Stop remaining listeners | | event.isPropagationStopped() | Check if stopped |

Listing

| Method | Description | |--------|-------------| | .before(step, receive?) | Bind to before phase of step | | .on(step, receive?) | Bind to on phase of step | | .after(step, receive?) | Bind to after phase of step |

Trace entry

{
    phase:    'on',
    step:     'ready',
    handler:  'MyHandler',
    duration: 1.23,   // ms
    at:       1234.5  // performance.now()
}

License

MIT