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

glitter-js

v1.2.1

Published

Basics singletons, methods and functions for any web projects

Readme

Glitter

USE CASE

Glitter is based on components. To be fully functionnal, it needs to have severals events setup.

import { engine } from 'glitter'

// when client's window is accessible
engine.ready = true

window.addEventListener('pointermove', engine.pointermove)
window.addEventListener('scroll', engine.scroll)

Component's methods and a few utils, are based on internal mechanism defined thanks to those lines.

NB: utils are originally made to be used as standalones. The only utils that are connected to shimmer's mechanisms are for performance benefits.

FILES STRUCTURE

  • component Defines shimmer Component and setup internal structure that supports Components Lifecycles and methods
  • utils Defines shimmer utils. Utils are standalone helper functions.
  • emitter Singleton implementation of emitter used internally to deal with events (for lifecycle, hooks, etc etc)

API

Engine

import { engine } from 'shimmer'

// when window is accessible
engine.ready = true

A singleton that runs the application. Functions needs to be called to allow every features. set property ready when object client's window is accessible.

Methods

  • pointermove (event: Event)
    • event: user event Required. Needs to be called on pointermove events
  • scroll (event: Event)
    • event: user event Required. Needs to be called on scroll events

Component

import { Component } from 'glitter'

const component = new Component()

Abstarct class.

Lifecycle

  • onResize ()
    • when window is resized OR body height or width changes (cause of content added for instance)
  • onScroll ()
    • when scroll on window
  • onUpdate ({ delta, elpased })
    • delta: time elapsed since the last frame
    • elpased: time elapsed since the beginning of the experience

Methods

  • destroy () To be called before removing the elements or when element is not used anymiore

Utils

Clock

import { clock } from 'shimmer'

clock.on({delta, elapsed} => {
  // code
})

A timer function that goes thourgh all the application. Used internally by all components.

Chronometer

import { Chronometer } from 'shimmer'

const chrono = new Chronometer()

chrono.on(({elapsed}) => {
  // console.log('plop', elapsed)
})

setTimeout(() => {
  chrono.start()
}, 3000)

A timer class depending on Clock Used internally by all components.

Timeout

import { Timeout } from 'shimmer'

const countdown = Timeout(3000, () => {
  // code
})
countdown.off()

A timeout function similar to setTimeout.

ToCanvas

import { ToCanvas } from 'shimmer'

const toCanvas = new ToCanvas({ image, video, width, height, muted = false, loop = true, fit })
toCanvas.promise.then(() => {
  code
  // if video
  toCanvas.start()
})

toCanvas.canvas
  • image: String. URL of the source if image
  • video: String. URL of the source if video. If image is also defined, it will be used as poster before video is able to play.
  • width: Int. Width of the generated canvas. If not defined, use source as value
  • height: Int. Height of the generated canvas. If not defined, use source as value
  • muted: Boolean. If source is video, set it to muted to allow autoplay
  • loop: Boolean. If source is video, set it to loop
  • fit: String. Allowed values are 'cover' or 'contained'. Default value is 'cover'

Generate a canvas with an image or a video sized as cover

Write code

Build project npm run build

Run example npm run start