daily pastebin goal
31%
SHARE
TWEET

Untitled

a guest Jul 18th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <meta charset="utf-8">
  5.   <meta name="viewport" content="width=device-width">
  6.   <title>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. console.log('Hello');
  12. let isActivated = false;
  13.  
  14. let checker = new Promise((resolve, reject)=>{
  15.   console.log('Promise is created!');
  16.   setTimeout(()=>{
  17.     if (isActivated) resolve();
  18.     reject();
  19.   }, 3000);
  20.    
  21. });
  22.  
  23. checker
  24.   .then(()=>{
  25.     console.log('Success', isActivated)
  26.   })
  27.   .catch(()=>{
  28.     console.log('Error')
  29.   });
  30.  
  31. isActivated = true;
  32. </script>
  33.  
  34.  
  35.  
  36. <script id="jsbin-source-javascript" type="text/javascript">console.log('Hello');
  37. let isActivated = false;
  38.  
  39. let checker = new Promise((resolve, reject)=>{
  40.   console.log('Promise is created!');
  41.   setTimeout(()=>{
  42.     if (isActivated) resolve();
  43.     reject();
  44.   }, 3000);
  45.    
  46. });
  47.  
  48. checker
  49.   .then(()=>{
  50.     console.log('Success', isActivated)
  51.   })
  52.   .catch(()=>{
  53.     console.log('Error')
  54.   });
  55.  
  56. isActivated = true;
  57.  
  58. </script></body>
  59. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top