## helma.Aspects

    Object
       |
       +--helma.Aspects

Defined in Aspects.js

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Constructor Summary
`helma.Aspects()` Library for adding Aspects Provides static methods to wrap existing functions inside a javascript closure in order to add additional behavior without overriding the existing one.

Methods Summary
`Function` | `addAfter(<Object> obj, <String> fname, <Function> after)` Adds a function to be called after an existing function.
`Function` | `addAround(<Object> obj, <String> fname, <Function> around)` Wraps an additional function around the original function.
`Function` | `addBefore(<Object> obj, <String> fname, <Function> before)` Adds a function to be called before the orginal function.

Constructor Detail

### helma.Aspects

    helma.Aspects()

Library for adding Aspects
Provides static methods to wrap existing functions inside a javascript closure in order to add additional behavior without overriding the existing one.
Based on code by roman porotnikov, http://www.jroller.com/page/deep/20030701
Note: Each prototype that uses aspects must implement a method onCodeUpdate() to prevent aspects being lost when the prototype is re-compiled

Method Detail

### addAfter

    Function addAfter(<Object> obj, <String> fname, <Function> after)

Adds a function to be called after an existing function.
The return value of the original function is passed to the added function as its first argument. In addition, the added function also receives an array of the original arguments, the original function and the scope object of the original function as additional parameters.

Parameters:

`obj` - as Object, the object of which the original function is a property

`fname` - as String, the property name of the original function

`after` - as Function, the function to be called after the original function

Returns:

Function A new function, wrapping the original function

### addAround

    Function addAround(<Object> obj, <String> fname, <Function> around)

Wraps an additional function around the original function.
The added function receives as its arguments an array of the original arguments, the original function and the scope object of the original function. The original function is not called directly and needs to be invoked by the added function.

Parameters:

`obj` - as Object, the object of which the original function is a property

`fname` - as String, the property name of the original function

`around` - as Function, the function to be called inside the original function

Returns:

Function A new function, wrapping the original function

### addBefore

    Function addBefore(<Object> obj, <String> fname, <Function> before)

Adds a function to be called before the orginal function.
The return value of the added function needs to provide the array of arguments that is passed to the original function.

Parameters:

`obj` - The object of which the original function is a property

`fname` - The property name of the original function

`before` - The function to be called before the original function

Returns:

Function A new function, wrapping the original function

SUMMARY: Constructor | Properties | Methods | DETAIL: Constructor | Properties | Methods

Documentation generated by JSDoc on Thu Apr 5 01:59:00 2007