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

test-code-protection

v3.1.4

Published

|Version | Framework | |--- |--- | | 3.0.1 | Angular |

Downloads

60

Readme

CodeProtection

|Version | Framework | |--- |--- | | 3.0.1 | Angular |

Configuration

By default all the features are disable, so you need to configure the features that you want to use. The configuration is an interface with the next structure:

interface Configuration {
    preventDeveloperTools ?: boolean;
    windowBlur ?: Action;
    visibilityChange ?: Action;
    debuggerOn ?: Action;
    timeout ?: TimerAction;
}

| Attribute | Type | Description| |---|---|---| | preventDeveloperTools | boolena| Disable the context menu and the shotcuts used for access to Developer Tools| | windowBlur | Action | Detects when the document is not active and excecutes the configured task | | visibilityChange | Action| Detects when the window is not active and excecutes the configured task | | debuggerOn | Action| Detects when the developer tools window is active and excecutes the configured task | | timeout |TimerAction | Enable a timer and excecutes the configured task whent the timeout|

Action & TimerAction

interface Action {
   enabled: boolean;
   behavior ?: ActionBehavior;
}
interface TimerAction extends Action {
   maxTime?: number;
}

| Attribute | Type | Description | |---|---|---| | enabled | boolean| Enable/disable the task| | behavior | ActionBehavior | Sets the behavior triggered when the user's action is detected | | maxTime (only for timeout)| number | Sets the time to wait in miliseconds before the timer action be triggerred |

ActionBehavior | Value | Description | |---|---| | ERROR_MESSAGE | The directives will notify an error | | REDIRECT | Redirects the user to the component defined through the redirectionToComponent attribute |

Example

{
    preventDeveloperTools : true,
    windowBlur : {enabled : true, behavior : ActionBehavior.ERROR_MESSAGE},
    visibilityChange : {enabled : true, behavior : ActionBehavior.ERROR_MESSAGE},
    debuggerOn : {enabled: false, behavior : ActionBehavior.ERROR_MESSAGE},
    timeout: {enabled: false, behavior : ActionBehavior.ERROR_MESSAGE, maxTime: 5 * 60 * 1000}
};

Global code protection (global-code-protection)

Description

Global code protections is an Angular Directive that allows the developer to prevent some user's behavior along all the app.

How to use

Just add the global-code-protection tag in the HTML file and set your custom configuration through the [configuration] attribute.

  • If some configuration attribute has as ActionBehavior the "REDIRECT" value, the redirection will be to the "redirectionToComponent" attribute, so add the route you want the user to be redirected
  • If some configuration attribute has as ActionBehavior the "ERROR_MESSAGE" value, the error will be notified through the "(onerror)" event, so set your method's name that will manage the errors
<global-code-protection 
  [configuration]="config" 
  redirectionToComponent="error" 
  (onerror)="onerror($event)">
</global-code-protection>

Suggestion Use this directive in app.component.html

Global code protection service

Code protection (component level)

<component 
  code-protection 
  [configuration]="config" 
  (onerror)="onerror($event)" >
</component>