@codevadmin/mdn-custom-event-polyfill

1.0.1 • Public • Published

mdn-custom-event-polyfill

This is a MDN implementation of CustomEvent API for browsers that don't support it.

Intstall

Using yarn:

  yarn add @codevadmin/mdn-custom-event-polyfill -S

Using npm:

  npm i -S @codevadmin/mdn-custom-event-polyfill

Usage

Just import this polyfill before using any code with CustomEvent object.

import '@codevadmin/mdn-custom-event-polyfill';

const body = document.querySelector('body');
const payload = [0, 1, 2, 3];
const event = new CustomEvent('run', { 
  detail: { 
    payload,
  },
});

body.dispatchEvent(event);

Support

It was successfully tested in IE 11. MDN tells the polyfill will work in IE 9+.

Package Sidebar

Install

npm i @codevadmin/mdn-custom-event-polyfill

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

13.7 kB

Total Files

4

Last publish

Collaborators

  • codevadmin