# event-target-shim-es5

> [![npm version](https://img.shields.io/npm/v/event-target-shim-es5.svg)](https://www.npmjs.com/package/event-target-shim-es5) ![Node.js CI](https://github.com/compulim/event-target-shim-es5/workflows/Node.js%20CI/badge.svg)

Latest version **2.0.0** (published 2021-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install event-target-shim-es5
pnpm add event-target-shim-es5
yarn add event-target-shim-es5
bun add event-target-shim-es5
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-07-20 |
| First published | 2019-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 12.2.0 |
| Dependencies | 9 |
| Unpacked size | 34.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | yes |
| GitHub stars | 2 |
| Author | William Wong |
| Maintainers | compulim, spyip |
| Keywords | event, event target, eventtarget, event-target-shim |

## Links

- npm: https://www.npmjs.com/package/event-target-shim-es5
- Repository: https://github.com/compulim/event-target-shim-es5
- Homepage: https://github.com/compulim/event-target-shim-es5#readme
- Issues: https://github.com/compulim/event-target-shim-es5/issues
- npm.io page: https://npm.io/package/event-target-shim-es5

## Dependencies (9)

- [mkdirp](https://npm.io/package/mkdirp.md) ^1.0.4
- [terser](https://npm.io/package/terser.md) ^5.7.1
- [esbuild](https://npm.io/package/esbuild.md) ^0.12.15
- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.14.5
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.14.6
- [read-pkg-up](https://npm.io/package/read-pkg-up.md) ^8.0.0
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.14.7
- [@babel/runtime-corejs3](https://npm.io/package/@babel/runtime-corejs3.md) ^7.14.7
- [@babel/plugin-transform-runtime](https://npm.io/package/@babel/plugin-transform-runtime.md) ^7.14.5

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-07-20
- 2.0.1-master.d647b91 (master) — 2021-07-20
- 2.0.0-master.9260f56 — 2021-07-19
- 2.0.0-master.c9e071f — 2021-07-15
- 2.0.0-master.416b327 — 2021-07-14
- 1.2.3-master.97aaea3 — 2021-07-14
- 1.2.2 — 2021-07-14
- 1.2.2-master.e0efe8e — 2021-07-14
- 1.2.2-master.e7a5b62 — 2021-07-14
- 1.2.1 — 2021-07-14
- 1.2.1-master.bfb011f — 2021-07-14
- 1.2.1-master.375c9ad — 2020-08-06
- 1.2.0 — 2020-08-06
- 1.1.1-master.0cf7879 — 2020-08-06
- 1.1.1-master.9ec6dd2 — 2020-05-26
- … 19 more at https://npm.io/package/event-target-shim-es5/versions

## README

# event-target-shim-es5

[![npm version](https://img.shields.io/npm/v/event-target-shim-es5.svg)](https://www.npmjs.com/package/event-target-shim-es5) ![Node.js CI](https://github.com/compulim/event-target-shim-es5/workflows/Node.js%20CI/badge.svg)

This package is based on [`event-target-shim`](https://npmjs.com/package/event-target-shim). Although the original package contains an [ES5 bundle](https://unpkg.com/event-target-shim/dist/event-target-shim.umd.js), it did not contains an ES5 module. Importing the module directly or indirectly may break web apps running on ES5 browsers.

On install, this package will transpile your version of `event-target-shim` to make it compatible with ES5 browsers.

Package authors should consider importing this package instead of `event-target-shim`, so your packages will not break your users due to having `event-target-shim` as a transient dependency.

## How to use

To install in your project, run:

```sh
npm install event-target-shim event-target-shim-es5
```

In your code:

```js
import EventTarget, { defineEventAttribute } from 'event-target-shim-es5';

class YourComponent extends EventTarget {
  handleClick() {
    this.dispatchEvent(new Event('click'));
  }
}

defineEventAttribute(YourComponent.prototype, 'click');
```

## How it works

On `postinstall`, this package will run Babel and Webpack to transpile `event-target-shim` into a single file.

This package peer-depends on `event-target-shim`. Thus, you can select your own version of `event-target-shim`.

### Updating `event-target-shim`

When you update `event-target-shim`, re-run `npm install event-target-shim-es5` to get the latest package transpiled.

## Alternatives

Instead of importing this package, there are alternative workarounds you can use.

### Including the source code

You can copy the source code of `event-target-shim` into your web app and use your build pipeline transpile the original package.

When copying, be sure to include the original license and continue to depends on the package to make sure `npm audit` will scan for vulnerabilities.

### Modify your bundler configuration

Webpack do not transpile code under `/node_modules/` unless specified explicitly. You can modify `webpack.config.js` to include `/node_modules/event-target-shim/` and use `babel-loader` to transpile it on-the-fly.

## Contributions

Like us? [Star](https://github.com/compulim/event-target-shim-es5/stargazers) us.

Want to make it better? [File](https://github.com/compulim/event-target-shim-es5/issues) us an issue.

Don't like something you see? [Submit](https://github.com/compulim/event-target-shim-es5/pulls) a pull request.

---
_Source: https://npm.io/package/event-target-shim-es5 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
