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

@prepair/basic-loader

v1.3.0

Published

David Walsh's super simple loader for loading image, CSS, and JavaScript files.

Downloads

40

Readme

basic-loader

David Walsh's super simple loader for loading image, CSS, and JavaScript files.

installation

npm i -S @prepair/basic-loader
  • Requires browser environment (dom).
  • Transpiled to es2015+ie context (polyfills not included).

usage

import load from '@prepair/basic-loader'

Promise.all([
  load.js('lib/highlighter.js'),
  load.js('lib/main.js'),
  load.css('lib/highlighter.css'),
  load.img('images/logo.png')
]).then(() => {
  console.log('Everything has loaded!');
}).catch(err => {
  console.log('Oh no, epic failure!');
});

add optional attributes

load.js('lib/main.js', {
  'data-foo': 'new-attribute',
  'data-bar': 'new-attribute-2'
})

caveats

  • Loading is not sequential of course. In the above example "main.js" may be parsed before "highlighter.js". If you want in order loading, use a sequential promise executor or a then chain.
  • Style loading may not work with very old mobile borwsers. Followup is here, see addendum below.
  • The e2e test runner breaks (in phantom, but the test.html works in the browser) this is caused by an old phantomjs version in the mocha-phantomjs package. Issue is here. Solutions:
    • either wait for the upstream package to be updated
    • or update the binary manually (inside node_modules)

exposed test

Temporarily the e2e standalone test page has been exposed to docs and is made available as a github page. TODO: use browserstack or smg similar?

  • [x] Chrome/30 Mobile Safari/537.6 (android 4.4.2), from 2013
  • [x] iOS 10.2.1 (vanilla iphone 6)
  • [x] Firefox 51.0.3 (android 4.4.2)