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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@felixkletti/managementjs

v0.6.0

Published

Originally developer for Angular this is the ongoing port into Vanilla JS of a library allowing for easy event driven architecture

Downloads

1,534

Readme

Welcome to ManagementJS

Originally developer for Angular this is the ongoing port into Vanilla JS of a library allowing for easy event driven architecture

Installation

via npm

npm i @felixkletti/managementjs

Thats it :)

Getting started

Global Store

Want to share data globally and know when a variable is updated and which one ? The store is here for you.

To get started you want to create a Store first. Duh. A store is simply a class that extends the ManagementJS Store abstract class and then is transformed through the getStore function. Here an example :

class myStore extends Store{
        root_string_variable_undefined?: string;
        root_string_variable_defined: string = 'root_string_variable_defined';
        root_number_variable_undefined?: number;
        root_number_variable_defined: number = 5;

        root_string_array_undefined?: Array<string>;
        root_string_array_defined: Array<string> = ['root_string_array_defined'];

        root_object_undefined?: {
            object_string_variable_defined: 'object_string_variable_defined';
            object_string_variable_undefined: 'object_string_variable_undefined';
        }
        root_object_defined: {
            object_string_variable_defined: 'object_string_variable_defined';
            object_string_variable_undefined?: 'object_string_variable_undefined';
        } = {
            object_string_variable_defined: "object_string_variable_defined"
        }
        constructor() {
            super();
        }
    }
    const S= getStore( myStore);

Now that you have an instance of your store you can keep working on your myStore class(treat it like you would any other class) or use it somewhere else.

Maybe you just want to know when a variable is updated at any time.

const test_value = 'new value';
// currently S.root_string_variable_undefined = root_string_variable_defined
const terminate = S.onChange(
    S, // Here you are observing the whole store, you could also go deeper into a nested object and observe only a specific part of it.
    (val) => { // here we have our callback which will trigger anytime the object or any variable within the object is updated
    /// val = 'new value'
    }, 
    'root_string_variable_undefined' // here we have an optional discriminator specifying the primitive variable within the targeted object that we are interested in. This allowas us to only be notified when this specific value is updated
);
 S.root_string_variable_undefined = test_value; // we simply pass a new value onto our variable and the callback will be triggered as soon as the current page lifecycle ends.

Browser Events

Handle events throughout the frontend anywhere while retaining typesafety ?

Cloud Events

Connect any backend ( REST / WS / custom) to your Browser Events and make the whole infrastructure reactive