Namespace: functors

core. functors

The core.functors package is a modular JavaScript library that provides extra Function methods.

Author:
License:

Methods


aop(func, begin, end, scope)

Creates a Function who execute a specific function between two others.

Parameters:
Name Type Description
func function

The function to invoke.

begin function

The function to invoke before the main function.

end function

The function to invoke after the main function.

scope Object

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 ) ;