eruda-pixel
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

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.

Package Sidebar

Install

npm i eruda-pixel

Weekly Downloads

43

Version

1.0.13

License

MIT

Unpacked Size

1.06 MB

Total Files

4

Last publish

Collaborators

  • faithree