See the dojox/lang/aspect reference documentation for more information.
Attach AOP-style advices to a method.
Attaches AOP-style advices to a method. Can attach several advices at once and operate on several methods of an object. The latter is achieved when a RegExp is specified as a method name, or an array of strings and regular expressions is used. In this case all functional methods that satisfy the RegExp condition are processed. This function returns a handle, which can be used to unadvise, or null, if advising has failed.
This function is a convenience wrapper for dojox.lang.aspect.adviseRaw().
Parameter | Type | Description |
---|---|---|
obj | Object | A source object for the advised function. Cannot be a DOM node. If this object is a constructor, its prototype is advised. |
method | String | RegExp | Array | A string name of the function in obj. In case of RegExp all methods of obj matching the regular expression are advised. |
advice | Object | Function | Array | An object, which defines advises, or a function, which returns such object, or an array of previous items. The advice object can define following member functions: before, around, afterReturning, afterThrowing, after. If the function is supplied, it is called with a context object once per call to create a temporary advice object, which is destroyed after the processing. The temporary advice object can implement a destroy() method, if it wants to be called when not needed. |
Attach AOP-style advices to methods.
Attaches AOP-style advices to object's methods. Can attach several advices at once and operate on several methods of the object. The latter is achieved when a RegExp is specified as a method name. In this case all functional methods that satisfy the RegExp condition are processed. This function returns a handle, which can be used to unadvise, or null, if advising has failed.
Parameter | Type | Description |
---|---|---|
obj | Object | A source object for the advised function. Cannot be a DOM node. |
methods | Array | An array of method names (strings) to be advised. |
advices | Array | An array of advices represented by objects or functions that return such objects on demand during the event processing. The advice object can define following member functions: before, around, afterReturning, afterThrowing, after. If the function is supplied, it is called with a context object once per call to create a temporary advice object, which is destroyed after the processing. The temporary advice object can implement a destroy() method, if it wants to be called when not needed. |
Returns the context stack, which reflects executing advices up to this point. The array is ordered from oldest to newest. In order to get the active context use dojox.lang.aspect.getContext().
Call the original function (or the next level around advice) in an around advice code.
Calls the original function (or the next level around advice). Accepts and passes on any number of arguments, and returns a value. This function is valid only in the content of around calls.
Detach previously attached AOP-style advices.
Parameter | Type | Description |
---|---|---|
handle | Object | The object returned by dojox.lang.aspect.advise(). |