PageRenderTime 268ms CodeModel.GetById 233ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/data/layouts/default/Content/js/profiling/config.js

http://github.com/jacksonh/manos
JavaScript | 59 lines | 27 code | 19 blank | 13 comment | 3 complexity | 5a846c86e1a35fd1e748bc3fbb390903 MD5 | raw file
 1
 2
 3// call PROFILE.show() to show the profileViewer
 4
 5var PROFILE = {
 6
 7  init : function(bool) {
 8  
 9  	// define what objects, constructors and functions you want to profile
10  	// documentation here: http://developer.yahoo.com/yui/profiler/
11  	
12  	YAHOO.tool.Profiler.registerObject("jQuery", jQuery, true);
13  	
14  	// the following would profile all methods within constructor's prototype
15    // YAHOO.tool.Profiler.registerConstructor("Person");
16  	
17    // the following would profile the global function sayHi
18    // YAHOO.tool.Profiler.registerFunction("sayHi", window); 
19    
20    // if true is passed into init(), F9 will bring up the profiler
21    if (bool){
22      $(document).keyup(function(e){
23        if (e.keyCode === 120){ 
24          PROFILE.show(); 
25          $(document).unbind('keyup',arguments.callee); 
26        }
27      })
28    }
29  },
30  
31  //When the showProfile button is clicked, use YUI Loader to get all required
32  //dependencies and then show the profile:
33  show : function() {
34  
35          
36          
37          var s = document.createElement('link');
38          s.setAttribute('rel','stylesheet');      
39          s.setAttribute('type','text/css');
40          s.setAttribute('href','js/profiling/yahoo-profiling.css');
41          document.body.appendChild(s);
42          
43	        YAHOO.util.Dom.addClass(document.body, 'yui-skin-sam');
44
45      		//instantiate ProfilerViewer with desired options:
46      		var pv = new YAHOO.widget.ProfilerViewer("", {
47      			visible: true, //expand the viewer mmediately after instantiation
48      			showChart: true,
49      		  //	base:"../../build/",
50      		  swfUrl: "js/profiling/charts.swf"
51      		});
52  	
53  }
54
55};
56
57// check some global debug variable to see if we should be profiling..
58if (true) { PROFILE.init(true) }
59