Teamwork / node-auto-launch

Launch applications or executables at login (Mac, Windows, and Linux)
MIT License
946 stars 113 forks source link

Feature 21 add toggle method #121

Open dstutemann opened 8 months ago

dstutemann commented 8 months ago

Target Platform

What Problem does this solve?

This adds functionality requested in issue #21

Could it break existing functionality

No, this just adds a new function and does not modify existing functions

Additional Info

I have tested this using a test project on Windows and macOS. Somebody should test it on Linux as I am not a Linux user.

Oxalin commented 7 months ago

Hi @dstutemann

Would it be simple and as efficient to use toggle() without any parameter? First, toggling is expected to change a given state to another one. Secondly, toggling with a parameter seems redundant to the enable() and disabled() methods, unless I'm missing something.

Also, I'm wondering if this should be added to the 5.x.x branch or the 6.x.x branch, which got rid of coffeescript. While we could add it to the 5.x.x branch, I don't know if we want to add/port new features to it?

dstutemann commented 7 months ago

Hi @Oxalin, I added the optional parameter value as it was requested in the issue. If you don't specify a parameter the function will toggle the state to the opposite, if you specify a parameter it will toggle to the desired state.

Unfortunately I can't see the 6.x.x branch.

I took the issue because it was marked as "good first issue". Feel free to close this PR if you decide that the feature isn't needed anymore.

Oxalin commented 7 months ago

I think the feature would simplify some logic that many apps need to implement.

Under Code > Tags, the latest entry is 6.0.0-rc1.

Oxalin commented 7 months ago

I'll keep this PR opened until we add it directly under the new JS code. Once 6.0.0 is out the door, I'll add it to 6.1.0