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

ng-lock-system

v0.0.1

Published

Lock system for components built in @angular

Readme

ng-lock-system

A simple repository which helps you to have a lock system over your application components or the application state

Features

  1. Any component which extends NgLockComponentBase will be added to the lock system
  2. NgLockComponentBase will cleanup it's data after each ngOnDestry

Usage

  1. Install npm install --save ng-lock-system
  2. Add to app root imports
@NgModule({
    imports: [NgLockSystemModule.provideLockSystem(
    true | false // enable logging
    )]
})
export class AppRootModule {}
  1. Use the lock system inside a component

@Component({
    selector: "my-cmp",
    // The locked observable will always reflect the correct value
    template: "is Locked {{isLocked$ | async}}"
})
export class MyCmp extends NgLockComponentBase {
    // isLocked$ => is an Observable<boolean> from the base class which should be true if the component is locked (do not subscribe to this subscription unless you unsubscribe from it manually)
    // isLocked => boolean from the base class it will not reflect the observable value only if we call this function `this.unWrapLockSubscription()` which creates a subscription to isLocked$ Observable, this subscription will be cleaned up after on destroy cycle
    constructor() {
        super();
    }
    
    markAsBusyComponent() {
        this.busy();
        console.log("is Locked ", this.isLocked) => will write false
        setTimeout(() => {
            this.busy(false);
            console.log("is Locked ", this.isLocked) => will write false
        }, 500);
    }
    
    markAsBusyWithObservableUnwraped() {
        this.unWrapLockSubscription(); // call this fuction only once
        this.busy();
        console.log("is Locked ", this.isLocked) => will write true
        setTimeout(() => {
            this.busy(false);
            console.log("is Locked ", this.isLocked) => will write false
        }, 500);
    }
    
    // The base class assignes to the component unique id to identify it
    // if you want to change the id you can do that like this
    markAsBusyWithChangedIf() {
        this.unWrapLockSubscription();
        // you can call this.unWrapLockSubscription(); before changing the component id
        // the subscription will update with the new subscription based on the new id           
        this.setComponentId("My_Favorite_Component");
        this.busy();
        console.log("is Locked ", this.isLocked) => will write true
        setTimeout(() => {
            this.busy(false);
            console.log("is Locked ", this.isLocked) => will write false
        }, 500);
    }
}
  1. Use LockManagerService
@Component({
    selector: "my-cmp",
    template: "is Locked {{isLocked$ | async}}"
})
export class MyCmp {
    isLocked$: Observable<boolean>;
    constructor(private lockManager: LockManagerService) {
        this.isLocked$ = this.lockManager.listenTo(); // listen to manager to full state 
        // the value will be true if a components will lock the whole manager
        // and false otherwise
        // the lock manager is a Dictionary<{ status: string, lockManager: boolean }>
        // lockManager affects the manager state 
        // status lets us to lock single components to not affect the over all state
        // for example I have a list component and it should be locked while I read data from the server I can use lockManager -> true and have a lock over all app 
        //or just lock the simple component
        
        this.isLocked$ = this.lockManager.listenTo("MY_COMPONENT_ID"); // listen to one component (true if component is locked, false otherwise)
        this.isLocked$ = this.lockManager.listenTo([
        "MY_COMPONENT_ID",
        "MY_SECOND_COMPONENT_ID",
        "MY_THIRE_COMPONENT_ID"
        ]); // listen to multiple component id's  (true if one component is locked, false otherwise)
        
        this.lockManager.lockComponent("MY_COMPONENT_ID");
        this.lockManager.lockComponent(
            "MY_COMPONENT_ID", 
            true // mark app as locked
        );
        this.lockManager.unlockComponent(
            "MY_COMPONENT_ID" // mark the components as unlocked
        );
        
        let subs = this.lockManager.listenTo("MY_COMPONENT_ID").subscribe(v => console.log(v));
        // To clean up the subscription you can call
        this.lockManager.unListen(subs); // subs can be an array of subscriptions
        // It will take out the component from the lock dictionary
        this.lockManager.removeComponent("MY_COMPONENT_ID");
    }

In progress, planned, and non-planned features

  1. Add automated tests for the service
  2. Make the api as friendly as possible