test-console-api.html (2376B)
1 <!DOCTYPE HTML> 2 <html dir="ltr" xml:lang="en-US" lang="en-US"> 3 <head> 4 <meta charset=utf8> 5 <title>Console API test page</title> 6 <script type="text/javascript"> 7 window.foobar585956c = function(a) { 8 console.trace(); 9 return a + "c"; 10 }; 11 12 /* global foobar585956c */ 13 function foobar585956b(a) { 14 return foobar585956c(a + "b"); 15 } 16 17 function foobar585956a(omg) { 18 return foobar585956b(omg + "a"); 19 } 20 21 function foobar646025(omg) { 22 console.log(omg, "o", "d"); 23 } 24 25 function startTimer(timer) { 26 console.time(timer); 27 } 28 29 function stopTimer(timer) { 30 console.timeEnd(timer); 31 } 32 33 function namelessTimer() { 34 console.time(); 35 console.timeEnd(); 36 } 37 38 function test() { 39 var str = "Test Message."; 40 console.foobar(str); // if this throws, we don't execute following funcs 41 console.log(str); 42 console.info(str); 43 console.warn(str); 44 console.error(str); 45 console.exception(str); 46 console.assert(false, str); 47 console.count(str); 48 } 49 50 function testGroups() { 51 console.groupCollapsed("a", "group"); 52 console.group("b", "group"); 53 console.groupEnd(); 54 } 55 56 function nativeCallback() { 57 new Promise(function(resolve) { resolve(42); }).then(console.log); 58 } 59 60 function timeStamp(val) { 61 console.timeStamp(val); 62 } 63 </script> 64 </head> 65 <body> 66 <h1>Console API Test Page</h1> 67 <button onclick="test();">Log stuff</button> 68 <button id="test-trace" onclick="foobar585956a('omg');">Test trace</button> 69 <button id="test-location" onclick="foobar646025('omg');">Test location</button> 70 <button id="test-nativeCallback" onclick="nativeCallback();">Test nativeCallback</button> 71 <button id="test-groups" onclick="testGroups();">Test groups</button> 72 <button id="test-time" onclick="startTimer('foo');">Test time</button> 73 <button id="test-timeEnd" onclick="stopTimer('foo');">Test timeEnd</button> 74 <button id="test-namelessTimer" onclick="namelessTimer();">Test namelessTimer</button> 75 <button id="test-timeStamp" onclick="timeStamp('!!!')">Test timeStamp</button> 76 <button id="test-emptyTimeStamp" onclick="timeStamp();">Test emptyTimeStamp</button> 77 </body> 78 </html>