Teamwork/node-auto-launch

Add `toggle` method for easy enable/disable

Open

#21 aperta il 10 feb 2016

Vedi su GitHub
 (1 commento) (1 reazione) (1 assegnatario)CoffeeScript (111 fork)batch import
enhancementgood first issuehelp wanted

Metriche repository

Star
 (911 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor