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

atd-browser-support

v1.0.11

Published

Browser support module for web development

Downloads

7

Readme

ATD Browser Support

A conditional front end polyfill loader based on 3 levels of browser support. This idea was extrapolated from an idea from Philip Walton. In addition to translating the polyfill loader into a node module, a third browser support tier has been added.

Browser support levels are:

  • Modern (fully supports)
  • Legacy (partially supports)
  • Deprecated (browsers with low support such as IE 9-, because sometimes, reality bites)

Note: This module was developed for AirTight Design, a web design and developmemnt agency, for use in client web projects. It is built for how we work. If you would like to see any specific features or polyfills added, please file an issue on GitGub.

Setup

Add this to your project

npm install atd-browser-support --save

Include the module in your script and call the loadSupport function.

import Supports from 'atd-browser-support';

Supports.loadSupport(yourCallbackFunction);

The loadSupport function takes a callback function as a parameter (Promises cannot be depended upon yet). It is recommended to use this funtion to initialize your app after polyfills are loaded. This way we can minimize the code executed before then polfillys are ready.

Setting up the Polyfill JS Files

In order to load the polyfills on demand from the browser, the .js files must be copied over from the atd-browser-support module dist/js folder to your project's webroot.

One solution to this is to use the copy-webpack-plugin plugin for webpack.

Add it to your dependencies:

npm install copy-webpack-plugin --save-dev

Initialize in webpack.config.js

const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = {

    ...

  plugins: [
    new CopyWebpackPlugin([
        { 
            from: './node_modules/atd-legacy-polyfills/dist/js/atd-legacy-polyfills.js',
            to: 'atd-legacy-polyfills.js',
            copyUnmodified: true
        },
        { 
            from: './node_modules/atd-deprecated-polyfills/dist/js/atd-deprecated-polyfills.js',
            to: 'atd-deprecated-polyfills.js',
            copyUnmodified: true
        }
    ])
  ]
};

Change the to properties of the CoptyWebpackPlugin initialization objects to reflect your project's requirements.

Included Polyfills by Browser Tier

Modern Browsers

These browsers have a baseline of Modern support, currently defined in the module as:

if(typeof window.Promise === 'function')

This test will evolve as more polyfills are added to the module. If there is a need, a future version may include the ability to set tests and polyfill inclusion as desired.

Do not rely on these browsers to support every ES2015+ feature, but simply those included in the test above.

Legacy Browsers

Legacy Browsers (partial support) load polyfills from the atd-legacy-polyfills module.

Deprecated Browsers

Deprecated Browsers (partial support) load polyfills from the atd-deprecated-polyfills module.