Advertisement
piterskiy

Run last async script

Jul 13th, 2017
25,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <script data="async" src="https://pastebin.com/raw/Xx5ymUy4" async></script>
  4. <script data="async" src="https://pastebin.com/raw/EW7bK8ch" async></script>
  5. <script data="async" src="https://pastebin.com/raw/yMz7HBd8" async></script>
  6. </head>
  7. <body>
  8.  
  9. <script>
  10. let count = document.querySelectorAll('script[data="async"]').length, calls = 0;
  11. let f = () => {alert('Нужная функция')}
  12. window.callback = () => {
  13.     calls++;
  14.     if (calls >= count) {
  15.         f();
  16.     }
  17. }
  18. </script>
  19.  
  20. </body>
  21. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement