Skip to content

Is there any way to analyzed code in runtime? #1047

@easyfrog

Description

@easyfrog

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 ], ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions