Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function j2timer(e){
- window.tdiff || (window.tdiff = []);
- window.tdlog || (window.tdlog = []);
- window.fnred || (window.fnred = function(a,b){return a-b;});
- //toogle statement
- if( (tdiff.length+1) % 2){
- tdiff.push( Date.now());
- return;
- }
- tdlog.push(["TIMER:", Date.now()-tdiff[tdiff.length-1], "[msec]; NOW:", Date.now(), "; WHO:", e, this.constructor.toString().split("(")[0]]);
- //commet this line out
- //console.log(tdlog.pop().join(" ") );
- }
- j2timer();
- ...
- j2timer();
- This will result in:
- in "dbg"- mode
- 426TIMER: 12 [msec]; NOW: 1315664066896 ; WHO: function DOMWindow
- tdlog
- [
- Array[7]
- 0: "TIMER:"
- 1: 20
- 2: "[msec]; NOW:"
- 3: 1315664090219
- 4: "; WHO:"
- 5: undefined
- 6: "function DOMWindow"
- length: 7
- __proto__: Array[0]
- ]
Add Comment
Please, Sign In to add comment