0.2.2 • Published 6 years ago

ya v0.2.2

Weekly downloads
45
License
MIT
Repository
github
Last release
6 years ago

屋 ya - simple glob pub/sub store

Simple to use

simple event listening and emitting

const ya = require( 'ya' )
const store = ya()

store.on( 'foo', function ( data ) {
  console.log( data )
} )

store.emit( 'foo', 'bar' )

bar

glob ( minimatch ) event listening

store.glob( '/users/*', function ( evts ) {
  evts.forEach( function ( evt ) {
    console.log( evt.evt + ' ' + evt.data )
  } )
} )

store.emit( 'foo', 'bar' ) // not matched by above glob
store.emit( '/users/123', '123' )
store.emit( '/users/456', '456' )

console

/users/123 123
/users/456 456

About

Simple glob ( minimatch ) event emitting and listening.

Why

A nuggest above simple mutable {} state management and barebones EventEmitting, but nothing sophisticated like MobX or Redux.

Diffing, mutation and notification is all up to the user/programmer.

For who?

For people or projects that don't need a sophisticated store and can manage with the barebones.

This helps you maintain your ad-hoc mutable vanillajs {} state.

Good for tiny projects and prototyping where there is no point in configuring and maintaining a sophisticated store ( yet ).

How

minimatch

Alternatives

glob-events

Test

npm test
0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

10 years ago