Posted By

tennison on 09/09/10


Tagged

ie7 consoletime


Versions (?)

IE7 debug


 / Published in: JavaScript
 

  1. if (typeof console == "undefined"){
  2. // var debugBox = $('<div id="debugBox"><h2>Version 1.06</h2></div>').css({position:'absolute', top:'0', right:'0', background:'#ddd', color:'#000', border:'1px solid #ff0000', padding:'10px', 'z-index':'9999'}).appendTo('#wrapper_outer');
  3.  
  4. var IEConsole = function(){
  5. this.startTime = null;
  6. this.timerName = null;
  7. };
  8. IEConsole.prototype.time = function(name){
  9. this.startTime = new Date().getTime();
  10. this.timerName = name ? name : 'Default';
  11. }
  12. IEConsole.prototype.timeEnd = function(name){
  13. var end = new Date().getTime(),
  14. string = (this.timerName+' '+(end-this.startTime)+'ms');
  15.  
  16. //debugBox.append('<p>'+string+'</p>')
  17. this.startTime = null;
  18. this.timerName = null;
  19. }
  20. IEConsole.prototype.log = function(value){
  21. //debugBox.append('<p><strong>'+value+'</strong></p>')
  22. }
  23. var console = new IEConsole();
  24. };
  25.  
  26.  
  27. console.time('name')
  28. console.timeEnd('name')

Report this snippet  

You need to login to post a comment.