Created
October 14, 2015 01:10
-
-
Save jasonbellamy/d194790f1b2cd1214afa to your computer and use it in GitHub Desktop.
An example of a function thats uses unneeded anonymous function wrappers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stateManger = function () { | |
var active = false; | |
var setState = function(state) { | |
active = state; | |
}; | |
return { | |
toggle: function () { | |
return setState(!active); | |
}, | |
setActive: function () { | |
return setState(true); | |
}, | |
setInactive: function () { | |
return setState(false); | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment