Skip to content

estrattonbailey/loop.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loop.js

Bare-bones pub/sub event emitter. Inspired by knot.js. 347b gzipped.

Install

npm i loop.js --save

Usage

import loop from 'loop.js'

const events = loop()

events.on('print', msg => console.log(msg))

events.emit('print', 'Hello World!')

// logs 'Hello World!'

Loop can also accept an object to extend with its emitter methods.

const instance = loop({
  play: () => {},
  pause: () => {}
})

console.dir(instance)

/*
{
  on,
  emit,
  play,
  pause
}
*/

MIT License

About

Bare-bones pub/sub event emitter.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published