This is much useful to the EventEmitter. to analyzed the event name on fly.
generally the event name is a string. If there are dozens of events. Is difficult to remember the names of these events.
So, my idea is to dynamically bind the event name to a variable. It would be very pleasant if we could dynamically analyze the event name bound by this variable.
var signals = {
events: {}, // to hold the event's names
emit: function (name) {
this.events[name] = name; // bind to the events property
...
}
}
// event emitter
signals.emit('my-event-name', param);
// register events with auto completions
signals.on(signals.events.[ could show all events binded ], ...
This is much useful to the
EventEmitter
. to analyzed theevent name
on fly.generally the
event name
is astring
. If there are dozens of events. Is difficult to remember the names of these events.So, my idea is to dynamically bind the event name to a variable. It would be very pleasant if we could dynamically analyze the event name bound by this variable.