linnovate / meanio

meanio core module
MIT License
54 stars 73 forks source link

wildcard event support with EventEmitter2 + remove sts #102

Closed timelf123 closed 8 years ago

timelf123 commented 8 years ago

Adds wilcard event support with EventEmitter2 Removes STS.

Wildcard events let you match all events from a particular package:

Package.events.subscribe('user.*, function(event){
  console.log(event);
});

Where user is the type set in app.js

MeanUser.events.defaultData({
  type: 'user'
});

You can also listen to ALL events with onAny:

Package.events.onAny(function(event, value){
  console.log('This will log ALL events from any package, be careful!', event, value);
});

I removed sts and added a generic events implementation for 0.9.0, but imho this is more powerful and should be the default for both the current branch and 0.9.0

timelf123 commented 8 years ago

FYI this is breaking change on 0.5.5 if you were using events already. I plan to re-roll this on 0.6.0 soon