This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const delay = ms => { | |
return new Promise(resolve => { | |
setTimeout(() => resolve(), ms); | |
}); | |
}; | |
export default delay; | |
// example (1-second delay) | |
// await delay(1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getPostPriority = async function(nodeRef, priority){ | |
var node = await Post.findById(nodeRef) | |
priority.push(node); | |
for(var i = 0; i < node.children.length; i++) | |
await getPostPriority(node.children[i], priority); | |
return priority; | |
} |