GithubHelp home page GithubHelp logo

joseluisq / emitus Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 262 KB

Small Typescript Event Emitter. :zap:

License: MIT License

JavaScript 37.18% TypeScript 62.82%
event-emitter node-module umd javascript typescript

emitus's Introduction

Emitus npm npm Build Status JavaScript Style Guide

Small Typescript Event Emitter. ⚡

Some differences with Mitt

Mitt is a pretty cool and very small event emitter library out there, but Emitus differs with it in some aspects such as:

  • Emitus has been written and tested entirely in Typescript.
  • It uses an array of events instead of a hash.
  • It uses a simple for() iteration loop with if() controls, no map functions or coercion.
  • It doesn't support 'emit-all' or some wildcard feature.
  • Its size is just 285bytes minimized + gzipped (UMD) and 844bytes (CommonJS).

Install

Yarn

yarn add emitus --dev

NPM

npm install emitus --save-dev

UMD file is also available on unpkg:

<script src="https://unpkg.com/emitus/dist/emitus.umd.min.js"></script>

You can also use the library via window.emitus.

Usage

import { emitus, EmitusListener } from 'emitus'

interface Args { a: number, b: string }

const myArgs: Args = { a: 1, b: '2' }
const myEvent: EmitusListener<Args> = (name, args) => console.log(name, args)

const e = emitus()
e.on('MY_EVENT', myEvent)
e.emit('MY_EVENT', myArgs)

API

on

Register a custom event listener.

e.on (eventName: string, listener: EmitusListener): void

off

Unregister a custom event listener.

e.off (eventName: string, listener?: EmitusListener): void

emit

Calls listener registered for the event named eventName passing the supplied (optional) arguments.

e.emit (eventName: string, args?: any): void

Contributions

Feel free to send some pull request or issues.

License

MIT license

© 2018 José Luis Quintana

emitus's People

Contributors

joseluisq avatar renovate-bot avatar greenkeeper[bot] avatar

Stargazers

Rama Jakaria avatar

Watchers

James Cloos avatar  avatar  avatar

emitus's Issues

An in-range update of eslint-plugin-import is breaking the build 🚨

Version 2.4.0 of eslint-plugin-import just got published.

Branch Build failing 🚨
Dependency eslint-plugin-import
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 10 commits.

  • 44ca158 update utils changelog
  • a3728d7 bump eslint-module-utils to v2.1.0
  • 3e29169 bump v2.4.0
  • ea9c92c Merge pull request #737 from kevin940726/master
  • 8f9b403 fix typos, enforce type of array of strings in allow option
  • 95315e0 update CHANGELOG.md
  • 28e1623 eslint-module-utils: filePath in parserOptions (#840)
  • 2f690b4 update CI to build on Node 6+7 (#846)
  • 7d41745 write doc, add two more tests
  • dedfb11 add allow glob for rule no-unassigned-import, fix #671

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of jest-cli is breaking the build 🚨

Version 17.0.1 of jest-cli just got published.

Branch Build failing 🚨
Dependency jest-cli
Current Version 17.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As jest-cli is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • continuous-integration/travis-ci/pr The Travis CI build passed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Library optimizations

  • Update dependencies
  • Fast iterations
  • Better Typescript typings support
  • Improve tests
  • Benchmarks

An in-range update of jest-cli is breaking the build 🚨

Version 17.0.2 of jest-cli just got published.

Branch Build failing 🚨
Dependency jest-cli
Current Version 17.0.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As jest-cli is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

  • continuous-integration/travis-ci/pr The Travis CI build passed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of cross-env is breaking the build 🚨

Version 5.0.1 of cross-env just got published.

Branch Build failing 🚨
Dependency cross-env
Current Version 5.0.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As cross-env is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes v5.0.1

<a name"5.0.1">

5.0.1 (2017-06-08)

Bug Fixes

Commits

The new version differs by 2 commits.

  • b10de51 fix: Change splitter regex to use .* instead of .+ (#117)
  • c9908f3 test(JSON): add JSON value tests that work on both Windows and UNIX (#112)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.