ya

0.2.2 • Public • Published

屋 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

Package Sidebar

Install

npm i ya

Weekly Downloads

8

Version

0.2.2

License

MIT

Unpacked Size

14.9 kB

Total Files

3

Last publish

Collaborators

  • talmobi