Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement