node-auto-launch
node-auto-launch copied to clipboard
Add `toggle` method for easy enable/disable
Add toggle method for easy enable/disable. This makes it easy to set based based on a variable.
Current:
var somebool;
autoLauncher[(somebool ? 'enable' : 'disable')](function(err) {
console.log(err);
});
// or
(somebool ? autoLauncher.enable : autoLauncher.disable).bind(autoLauncher)(function(err){
console.log(err);
});
Desired:
var somebool;
autoLauncher.toggle(somebool, function(err) {
console.log(err);
});
This isn't a priority for us but we'll happily accept a pr for this change. Thanks for the suggestion!