Created
July 28, 2011 18:27
-
-
Save shinypb/1112174 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function doSomething() { | |
| // this is the main function | |
| }; | |
| // Style A - shorter, but names don't directly match when they run, which may be confusing | |
| doSomething.after(function() { | |
| // this runs before doSomething | |
| }); | |
| doSomething.before(function() { | |
| // this runs after doSomething | |
| }); | |
| // Style B - more explicit names when reading the code, but less descriptive of what they do | |
| doSomething.andThen(function() { | |
| // this runs after doSomething | |
| }); | |
| doSomething.butFirst(function() { | |
| // this runs before doSomething | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment