Do Class
+ + + + +Allows for the insertion of methods that are executed before or after +a specified method
+-
+
- Index + + +
- Methods + + +
- Properties + + + +
Item Index
+ + +Methods
+ + +Properties
+ +-
+
+
- + currentRetVal + + + static + + + + +
- + objs + + + static + + + deprecated + + + +
- + originalRetVal + + + static + + + + +
Methods
+ + +_inject
+
+
+ -
+
+
-
+
+
when+ +
+
+ -
+
+
fn+ +
+
+ -
+
+
obj+ +
+
+ -
+
+
sFn+ +
+
+ -
+
+
c+ +
+
+
Execute the supplied method before or after the specified function.
+Used by before and after.
Parameters:
+ +-
+
+
-
+
+
when+ String + + + + +++ + +before or after
+
+
+ -
+
+
fn+ Function + + + + +++ + +the function to execute
+
+
+ -
+
+
obj+ Object + + + + +++ + +the object hosting the method to displace
+
+
+ -
+
+
sFn+ String + + + + +++ + +the name of the method to displace
+
+
+ -
+
+
c+ Object + + + + +++ + +The execution context for fn
+
+
+
Returns:
+ +after
+
+
+ -
+
+
-
+
+
fn+ +
+
+ -
+
+
obj+ +
+
+ -
+
+
sFn+ +
+
+ -
+
+
c+ +
+
+ -
+
+
arg+ +
+
+
Execute the supplied method after the specified function. Wrapping +function may optionally return an instance of the following classes to +further alter runtime behavior:
+ +-
+
- Y.Do.Halt(message, returnValue) +
- Immediatly stop execution and return
+
returnValue. No other wrapping functions will be + executed.
+ - Y.Do.AlterReturn(message, returnValue) +
- Return
returnValueinstead of the wrapped + method's original return value. This can be further altered by + other after phase wrappers.
+
The static properties Y.Do.originalRetVal and
+Y.Do.currentRetVal will be populated for reference.
Parameters:
+ +-
+
+
-
+
+
fn+ Function + + + + +++ + +the function to execute
+
+
+ -
+
+
obj+ Object + + + + +++ + +the object hosting the method to displace
+
+
+ -
+
+
sFn+ String + + + + +++ + +the name of the method to displace
+
+
+ -
+
+
c+ Object + + + + +++ + +The execution context for fn
+
+
+ -
+
+
arg+ Mixed + + + + multiple + + +++ + +0..n additional arguments to supply to the subscriber
+
+
+
Returns:
+ +before
+
+
+ -
+
+
-
+
+
fn+ +
+
+ -
+
+
obj+ +
+
+ -
+
+
sFn+ +
+
+ -
+
+
c+ +
+
+ -
+
+
arg+ +
+
+
Execute the supplied method before the specified function. Wrapping +function may optionally return an instance of the following classes to +further alter runtime behavior:
+ +-
+
- Y.Do.Halt(message, returnValue) +
- Immediatly stop execution and return
+
returnValue. No other wrapping functions will be + executed.
+ - Y.Do.AlterArgs(message, newArgArray) +
- Replace the arguments that the original function will be + called with. +
- Y.Do.Prevent(message) +
- Don't execute the wrapped function. Other before phase + wrappers will be executed. +
Parameters:
+ +-
+
+
-
+
+
fn+ Function + + + + +++ + +the function to execute
+
+
+ -
+
+
obj+ Object + + + + +++ + +the object hosting the method to displace
+
+
+ -
+
+
sFn+ String + + + + +++ + +the name of the method to displace
+
+
+ -
+
+
c+ Object + + + + +++ + +The execution context for fn
+
+
+ -
+
+
arg+ Mixed + + + + multiple + + +++ + +0..n additional arguments to supply to the subscriber +when the event fires.
+
+
+
Returns:
+ +detach
+
+
+ -
+
+
-
+
+
handle+ +
+
+
Detach a before or after subscription.
+Parameters:
+ +-
+
+
-
+
+
handle+ String + + + + +++ + +the subscription handle
+
+
+
Properties
+ + +currentRetVal
+ Unknown
+
+
+
+
+
+
+
+
+ static
+
+
+
+
+ Contains the current state of the return value, consumable by +'after' event listeners, and updated if an after subscriber +changes the return value generated by the wrapped function.
+objs
+ Unknown
+
+
+ deprecated
+
+
+
+
+
+
+
+ static
+
+
+
+
+ Cache of objects touched by the utility
+originalRetVal
+ Unknown
+
+
+
+
+
+
+
+
+ static
+
+
+
+
+ Contains the return value from the wrapped method, accessible +by 'after' event listeners.
+