Methods
Returns Object
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. |
dojox.lang.aspect.adviseRaw Returns Object
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 Boolean
Returns true if the context stack contains a context for a given
instance that satisfies a given method name criteria.
| Parameter | Type | Description |
|---|
| instance | Object | An instance to be matched. If null, any context will be examined.
Otherwise the context should belong to this instance. |
| method | String|RegExp|Array | Optional. An optional pattern to be matched against a method name. Can be a string,
a RegExp object or an array of strings and RegExp objects.
If it is omitted, any name will satisfy the criteria. |
dojox.lang.aspect.counter Returns Object
Returns an object, which can be used to count calls to methods.
dojox.lang.aspect.getContext Returns Object
Returns the context information for the advice in effect.
dojox.lang.aspect.getContextStack Returns Array
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().
dojox.lang.aspect.memoizer Returns Object
Returns an object, which can be used to count calls to methods.
| Parameter | Type | Description |
|---|
| keyMaker | Function | Optional. the function, which takes method's arguments and returns a key,
which can be used to index the result. |
dojox.lang.aspect.memoizerGuard Returns Object
Invalidates the memoizer's cache (see dojox.lang.aspect.memoizer)
after calling certain methods.
| Parameter | Type | Description |
|---|
| method | String|Array | Optional. Optional method's name to be guarded: only cache for
this method will be invalidated on call. Can be a string
or an array of method names. If omitted the whole cache
will be invalidated. |
dojox.lang.aspect.proceed 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.
dojox.lang.aspect.profiler Returns Object
Returns an object, which can be used to time calls to methods.
| Parameter | Type | Description |
|---|
| title | String | Optional. The optional name of the profile section. |
Returns Object
Returns an object, which can be used to time calls to methods.
| Parameter | Type | Description |
|---|
| name | String | Optional. The optional unique name of the timer. |
Returns Object
Returns an object, which can be used to trace calls with Firebug's console.
Prints argument, a return value, or an exception.
| Parameter | Type | Description |
|---|
| grouping | Boolean | The flag to group output. If true, indents embedded console messages. |
dojox.lang.aspect.unadvise Detach previously attached AOP-style advices.
| Parameter | Type | Description |
|---|
| handle | Object | The object returned by dojox.lang.aspect.advise(). |