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

Provide a Way to Remove Callbacks in WebTerminal API #108

Closed
nikitaeverywhere opened this issue Jul 6, 2017 · 5 comments
Closed

Provide a Way to Remove Callbacks in WebTerminal API #108

nikitaeverywhere opened this issue Jul 6, 2017 · 5 comments
Assignees

Comments

@nikitaeverywhere
Copy link
Member

nikitaeverywhere commented Jul 6, 2017

Terminal API functions onOutput, onUserInput and execute (#107) are invoking callbacks, but there may be a need to stop triggering them at some point.

Provide some API to remove callbacks.

Info @wcjphoenix

@wcjphoenix
Copy link

Why do you need to stop them from triggering?

@nikitaeverywhere
Copy link
Member Author

nikitaeverywhere commented Jul 6, 2017

@wcjphoenix, one of the examples, I thought that when the user completes a task in your project, you may want to stop callback from happening. This is all about providing the complete pub-sub pattern. In JavaScript, for example, everywhere where you have .addEventListener(...), you also have .removeEventListener(...), so the WebTerminal should have both as well on my opinion.

@nikitaeverywhere
Copy link
Member Author

nikitaeverywhere commented Jul 6, 2017

Actually I made a little design mistake, I should have named the functions of terminal object this way: .on("input", options, callback) and .on("output", options, callback) to certainly match all JavaScript conventions. Also this is much better to read and extend.
What if we change the names, Walter? This will be the major breaking change, so maybe it is not worth it or at least, should wait until the next major WebTerminal update (which may happen as a result of #103).

@wcjphoenix
Copy link

I think it would be good to wait until the next update, but thanks for the explanation about the reasoning behind a remove function.

@nikitaeverywhere
Copy link
Member Author

Done by af4c564. I also updated WebTerminal global versions and added docs. If you have any further questions or suggestions, please tell me! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants