Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
easyfrog opened this issue Jun 6, 2021 · 0 comments
Open

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

easyfrog opened this issue Jun 6, 2021 · 0 comments

Comments

@easyfrog
Copy link

easyfrog commented Jun 6, 2021

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 ], ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant