Created
December 15, 2012 18:23
-
-
Save StevenBlack/4297836 to your computer and use it in GitHub Desktop.
Generative function to create a method and corresponding Pre- and Post- hook methods,
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
c={} | |
e="someMethod"; | |
preProcessPost =function(c,e) { | |
var e1=e+"Pre",e2=e+"Process",e3=e+"Post"; | |
c[e]=function(o){ | |
if (this[e1](o)) { | |
this[e2](o); | |
this[e3](o); | |
} | |
}; | |
c[e1]=function(o){return true;}; | |
c[e2]=function(o){}; | |
c[e3]=function(o){}; | |
}; | |
preProcessPost(c,e); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment