SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. exists: boolean; //here's the variable declaration at the beginning of the class
  2.  
  3. onCreateFolder(nodeId) { //the actual function
  4.  
  5. this.exists = false;
  6.  
  7. this.nodeService.getNodeChildren(nodeId).forEach(
  8.   node => {
  9.     node.list.entries.forEach(
  10.       actualNode => {
  11.         if(actualNode.entry.isFolder && actualNode.entry.name === theName) {
  12.           this.exists = true;
  13.           this.existingFolderId = actualNode.entry.id;
  14.           console.log("Found the existing folder! " + this.existingFolderId); //console log is beeing printed - so the if statement is true at least once so as this.exists should be set to true
  15.         }
  16.       }
  17.     )
  18.   }
  19. )
  20.  
  21. //after leaving the method above the it seems like this.exists goes back to false(?)
  22.  
  23.   if(!this.exists) {
  24.  
  25.   //always get into
  26.  
  27.   } else if(this.exists) {
  28.  
  29.   //never get into
  30.  
  31.   }
  32.  
  33.  
  34. }
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