Skip to content

Instantly share code, notes, and snippets.

@shinypb
Created July 28, 2011 18:27
Show Gist options
  • Select an option

  • Save shinypb/1112174 to your computer and use it in GitHub Desktop.

Select an option

Save shinypb/1112174 to your computer and use it in GitHub Desktop.
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