KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am dynamically loading code (functions) from a server and executing it as javascript code then storing it in an array and executing. All these snippets of code must be executed exactly once. The psuedocode follows as such function fetch(foo){ if (foo in fooArray){ //Do Nothing else{ //Fetch foo via Ajax and execute foo() } } The problem is vastly more complex, but essentially if I issue the below command fetch('someFunctionName'); fetch('someFunctionName'); fetch('someFunctionName'); fetch('someFunctionName'); all four will execute the if (foo in fooArray) and assume that it is not in the array, and all four will proceed to fetch the code and execute it. I remember back in the day learning about semaphores and mutexes, are there such things for javascript.
Tags (comma-separated)
Save Edits
Cancel