JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q56263F
  • License MIT

Package Exports

  • eruda-pixel
  • eruda-pixel/eruda-pixel.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eruda-pixel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eruda-pixel

Eruda plugin for UI.

A high-precision UI restoration aid that is dedicated to making front-end developers headaches and crashes. Designers check tools.

Demo

Browse it on your phone: https://eruda.liriliri.io/

Install

npm install eruda eruda-pixel -D
eruda.init();
eruda.add(erudaPixel);

CDN

const loadOneJS = (url, callback) => {
  const script = document.createElement('script');
  const fn = callback || (() => {});

  script.type = 'text/javascript';

  script.onload = () => {
    fn();
  };

  script.src = url;

  document.getElementsByTagName('head')[0].appendChild(script);
};
const loadJS = (urls, callback) => {
  let i = 0;
  const fn = callback || (() => {});

  urls.forEach((url) => {
    loadOneJS(url, () => {
      i = 1 + i;
      if (urls.length === i) {
        fn();
      }
    });
  });
};

loadJS(
  [
    '//cdn.bootcdn.net/ajax/libs/eruda/2.4.1/eruda.min.js',
    '//unpkg.com/eruda-pixel@1.0.13/eruda-pixel.js',
  ],
  () => {
    const eruda = window.eruda;
    if (typeof eruda !== 'undefined') {
      eruda.init();
      eruda.add(window.erudaPixel);
    }
  },
);

Make sure Eruda is loaded before this plugin, otherwise won't work.