The core.functors package is a modular JavaScript library that provides extra Function methods.
Methods
-
aop(func, begin, end, scope)
-
Creates a Function who execute a specific function between two others.
Parameters:
Name Type Description funcfunction The function to invoke.
beginfunction The function to invoke before the main function.
endfunction The function to invoke after the main function.
scopeObject The scope of the function to invoke after the main function.
Returns:
The new function with the aop merging.
- Type
- function
Example
var scope = { toString : function() { return "scope" ; } } ; var sum = function(x, y) { console.info( this + " calculating...") return x + y; } function begin() { trace("--- begin"); } function end() { trace("--- end"); } var result = aop(sum, begin, end, scope)(3, 5) ; console.log( result ) ;