1.0.0 • Published 10 months ago

@for-fun/event-emitter v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Build Status Coverage Status install size

event-emitter

Simple event emitter.

Install

npm i @for-fun/event-emitter

Usage

import * as React from 'react';
import {create, on, emit} from '@for-fun/event-emitter';

const emitter = create();

export default function() {
  const [message, setMessage] = React.useState('');
  React.useEffect(() => on(emitter, 'message', setMessage));

  return <div>
    <p>{message}</p>
    <button onClick={() => emit(emitter, 'message', 'hello')}>Click Me</button>
  </div>;
}

Compatibility Note

This lib support these browsers or devices with these methods or APIs pollyfilled.

Workflow

# develop
npm start

# build
npm run build

# test
npm test

# commit changes
npm run commit

# publish
npm publish
1.0.0

10 months ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

2 years ago

0.1.1

4 years ago

0.1.0

4 years ago