dreamcatcher-tech / dreamcatcher-stack

https://dreamcatcher.land
1 stars 0 forks source link

Move hooks to use Symbol instead of global #99

Open inverted-capital opened 2 years ago

inverted-capital commented 2 years ago

Much cleaner to use that polluting the global scope. Symbol.for() will give the same result no matter what version of the library is loaded, or if was transpiled.

Additionally we might be able to allow parallel hooks to run by making the first call be globally exclusive, then when the library calls the first time, it receives back a unique Symbol that it uses for each subsequent call, which means the global lock can be released.