Jump to Content

RSS Feeds:

Posts | Comments

http://ivanwlam.com/experiments/programming

One Response to “Console Profile”

  1. [...] Console Profile – available for browsers with developer tools. I didn’t know how to use this until I watched the video. But then again, it wasn’t a real need for me. [...]

Leave a Reply


Example

Get profile

HTML in Example

 <a style="width:100px;height:50px;background-color:#ffff00;cursor:pointer;display:block;" id="button">Get profile</a>

Written-out JavaScript at the end of the document

 <script type="text/javascript">  <!--  document.getElementById("button").addEventListener("click",clicked,false);    function clicked(){      console.profile("clicked");      doStuff();      doSomeElse();      console.profileEnd("clicked");      }    function doStuff(){      for(var i=0;i<10000;i++){          var j=(i*40);          }      }        function doSomeElse(){      var j=1;      for(var i=0;i<50;i++){          document.getElementById("button").innerHTML+=i+"<br />";          }      }  //-->  </script>