mirror of
https://github.com/NovaGM/ModuleBuilder.git
synced 2024-08-15 00:23:33 +00:00
[PCCompat > Util] Add sleep, waitFor
This commit is contained in:
parent
27847ca0b6
commit
0a8d8f09c8
1 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,16 @@
|
|||
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
module.exports = {
|
||||
sleep,
|
||||
|
||||
waitFor: async (query) => {
|
||||
while (true) {
|
||||
const el = document.querySelector(query);
|
||||
if (el) return el;
|
||||
|
||||
await sleep(5);
|
||||
}
|
||||
},
|
||||
|
||||
...goosemodScope.reactUtils // Export GooseMod React utils
|
||||
};
|
Loading…
Reference in a new issue