Profiler: Object Profiling Example
+ ++
This example shows using the Profiler on all methods in an object. It uses the Y.DOM object
+as the object to be profiled.
Object Profiling Example
+To illustrate using the Profiler on objects, the Y.DOM and Y.Node objects are registered for profiling. This means
+that all of the methods on these objects are being profiled. To
+illustrate their use, a number of demo elements are added to the markup:
The button is used to run the example. The function being called when the button is clicked is assigned by first
+ retrieving a Node instance for the button and then using the on method:
The function begins be registering Y.DOM and Y.Node with the Profiler. Note that since these objects don't
+ exist in the global scope, the second argument is necessary for registerObject(). Then, the Y.Node.all()
+ method is called to retrieve nodes for each element with a class of bar. The result of this operation is a NodeList
+ object, on which the addClass() method is called. After that, the full report is returned and the objects are unregistered. The last
+ step is to output all of the information that was collected. Even though there's only two methods called explicitly in this example,
+ the profiled data indicates that several other methods on Y.DOM and Y.Node were called internally to accomplish the
+ tasks.
