node-auto-launch icon indicating copy to clipboard operation
node-auto-launch copied to clipboard

Add `toggle` method for easy enable/disable

Open MadLittleMods opened this issue 9 years ago • 1 comments

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);
});

MadLittleMods avatar Feb 10 '16 01:02 MadLittleMods

This isn't a priority for us but we'll happily accept a pr for this change. Thanks for the suggestion!

4ver avatar Apr 04 '16 16:04 4ver