Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. var onChosenFileToOpen = function(theFileEntry) {
  2.  
  3. $('.nav-tabs li:nth-child(' + $(".nav-tabs").children().length + ') a').click(); //synchronous function that creates a tab
  4. var checker=setInterval(()=>{
  5. if(currentiframe.contentWindow && currentiframe.contentWindow.editor){//waits those 2 conditions to be true
  6. currentiframe.contentWindow.readFileIntoEditor(theFileEntry)//content is loaded to that tab
  7. clearInterval(checker)
  8. }
  9.  
  10. },1)};
  11.  
  12. var callagain=true;
  13. var tabstocreate=[]
  14. var onChosenFileToOpen = function(theFileEntry) {
  15. tabstocreate.push(theFileEntry)
  16. thequeue();
  17.  
  18.  
  19. };
  20.  
  21. function thequeue(){
  22.  
  23. if(callagain===true && tabstocreate.length>0){
  24.  
  25. $('.nav-tabs li:nth-child(' + $(".nav-tabs").children().length + ') a').click();
  26.  
  27. var checker=setInterval(()=>{
  28. if(currentiframe.contentWindow.editor){
  29. currentiframe.contentWindow.readFileIntoEditor(tabstocreate[0])
  30. tabstocreate.shift()
  31. clearInterval(checker)
  32. callagain=true
  33. if(tabstocreate.length>0){
  34. letsgobb()
  35. }
  36.  
  37. }
  38.  
  39. },1)
  40. callagain=false
  41. }
  42.  
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement