async.html 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
  6. <title>Dev: Async</title>
  7. <!-- <script src="../dist/vconsole.min.js"></script> -->
  8. </head>
  9. <body ontouchstart>
  10. <div class="page">
  11. <a onclick="formattedLog()" href="javascript:;" class="weui_btn weui_btn_default">formattedLog</a>
  12. </div>
  13. </body>
  14. </html>
  15. <script>
  16. console.log('document.readyState:', document.readyState);
  17. setTimeout(function() {
  18. console.log('Start to load vconsole.min.js. document.readyState:', document.readyState);
  19. var script = document.createElement('SCRIPT');
  20. script.src = '../dist/vconsole.min.js';
  21. script.onload = function() {
  22. window.vConsole = new window.VConsole({
  23. maxLogNumber: 1000,
  24. // disableLogScrolling: true,
  25. onReady: function() {
  26. console.log('vConsole is ready.');
  27. },
  28. onClearLog: function() {
  29. console.log('on clearLog');
  30. }
  31. });
  32. };
  33. document.documentElement.appendChild(script);
  34. }, 1000);
  35. function formattedLog() {
  36. console.info('formattedLog() Start');
  37. console.log('[default]', 'This log should be shown in Log tab.');
  38. console.log('[default]', 'Switch to System tab to see next log.');
  39. console.log('[system]', 'This log should be shown in System tab.');
  40. console.log('[foobar]', 'This log should be shown in Log tab.');
  41. console.info('formattedLog() End');
  42. }
  43. </script>
  44. <link href="../example/lib/weui.min.css" rel="stylesheet"/>
  45. <link href="../example/lib/demo.css" rel="stylesheet"/>