# multiplatform-events

> A simple NPM package to be able to use events everywhere!

Latest version **1.0.2** (published 2023-05-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install multiplatform-events
pnpm add multiplatform-events
yarn add multiplatform-events
bun add multiplatform-events
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-05-05 |
| First published | 2023-05-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Clément Tolois |
| Maintainers | clement.t |
| Keywords | events, eventemitter, browser, node, module |

## Links

- npm: https://www.npmjs.com/package/multiplatform-events
- Repository: https://github.com/ClementTolois/Multiplatform-Events
- Homepage: https://github.com/ClementTolois/Multiplatform-Events#readme
- Issues: https://github.com/ClementTolois/Multiplatform-Events/issues
- npm.io page: https://npm.io/package/multiplatform-events

## 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

- 1.0.2 (latest) — 2023-05-05
- 1.0.1 — 2023-05-05
- 1.0.0 — 2023-05-05

## README

# Multiplatform Events

## Overview

A really (really) simple event system for every JS project. As in nodejs you can extends the *MultiplatformEvents* class to create your own event system. Then you will be able to use the *on* *once* *off* and *emit* methods to manage your events.

## Installation

```bash
npm install multiplatform-events
```

## Usage

### Example 1
```js
import MultiplatformEvents from 'multiplatform-events';
// or
const MultiplatformEvents = require('multiplatform-events');

const events = new MultiplatformEvents();
events.on('myEvent', (data) => {
	console.log(data);
});
events.emit('myEvent', 'Hello World !');
// Hello World !
```

### Example 2
```js
import MultiplatformEvents from 'multiplatform-events';
// or
const MultiplatformEvents = require('multiplatform-events');

class MyEvents extends MultiplatformEvents {
	constructor() {
		super();
	}

	myMethod() {
		this.emit('myEvent', 'Hello World !');
	}
}

const events = new MyEvents();
events.on('myEvent', (data) => {
	console.log(data);
});
events.myMethod();
// Hello World !
```

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