Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.99 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.     <body>
  4.         <script src="https://unpkg.com/mithril/mithril.js" rel="stylesheet"></script>
  5.         <script>
  6.             console.log('Version', m.version);
  7.            
  8.             console.log('Before request');
  9.             var p = m.request({
  10.                 //url: 'http://www.google.fr',
  11.                 url: 'http://not-exists',
  12.                 // user: 'test',
  13.                 // password: 'test'
  14.             });
  15.             console.log('Request sent', p);
  16.            
  17.             p.then(function(result) {
  18.                 console.log('Promise resolved', result);
  19.             }).catch(function(error) {
  20.                 console.log('Promise failed', error);
  21.             });
  22.            
  23.             setTimeout(function() {
  24.                 console.log('After 5 seconds:', p);
  25.             }, 5000);
  26.  
  27.             setTimeout(function() {
  28.                 console.log('After 60 seconds:', p);
  29.             }, 60000);
  30.  
  31.         </script>
  32.     </body>
  33. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement