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

@gromy/haven

v0.9.0

Published

GDPR-ready cookie consent manager with type definitions and zero dependencies

Downloads

10

Readme

Overview

Haven is a simple-to-use cookie consent manager enabling GDPR and ePrivacy compliance with just a few lines of code. Haven comes with the following features included out of the box:

| | Feature | | ---- | ------------------------------------------------------------ | | 📣 | Cookie notification for opt-in and opt-out strategies. | | 🔧 | Cookie preferences enabling users to revoke or change their consent at any time. | | 📥 | Automatic injection of services (google-analytics, google-tag-manager, facebook-pixel or any custom solution) at runtime, after the user has given their consent. | | 🗑️ | Removal of all tracking cookies after a user has revoked their consent. | | 📙 | Translations for multiple languages with easy customization. | | 🤖 | Written in TS, and as such compatible with ES5, ES6+ and TS projects out of the box. |

Quickstart

Installation

npm i @chiiya/haven -S

Usage

To use Haven in your project, either load the library via a script tag in your HTML, or import it as a module in your Javascript.

<script src="https://unpkg.com/@chiiya/haven"></script>
<script>
Haven.create({
    services: [
        {
            name: 'google-analytics',
            options: {
                    id: 'UA-XXXXXXXX-1',
            },
            purposes: ['analytics'],
            inject: true,
        }
    ]
});
</script>
var { Haven } = require('haven');

Haven.create({
    services: [
        {
            name: 'google-analytics',
            options: {
                    id: 'UA-XXXXXXXX-1',
            },
            purposes: ['analytics'],
            inject: true,
        }
    ]
});
import Haven from '@chiiya/haven';

Haven.create({
    services: [
        {
            name: 'google-analytics',
            options: {
                    id: 'UA-XXXXXXXX-1',
            },
            purposes: ['analytics'],
            inject: true,
        }
    ]
});

With that, users will get a cookie notification asking for their consent. Google Analytics will only be loaded once this consent has been given. Users may revoke their consent at any time by using the settings injected into your privacy policy page. Upon consent revoke, all tracking cookies set by Google Analytics will be removed.

For further information and configuration details, check out the documentation.

Polyfills

Haven is compiled using Babel targeting browsers with more than 1% of global usage and expecting that all features listed below are available or polyfilled in browser:

Object.keys()
Object.values()
Object.assign()
String.startsWith()
Array.flat()
Array.forEach()
Set

If you need to support a browser that does not have one of the features listed above, I suggest including a polyfill from polyfill.io:

<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=Object.keys%2CObject.values%2CObject.assign%2CSet%2CString.prototype.startsWith%2CArray.prototype.flat"></script>