Simple WaitForKeyElement

Library that Exports my simplified vanilla JS version of WaitForKeyElement, which is a simple async function that returns a Promise that resolves to an element by a given selector, when that element is found

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/511024/1460585/Simple%20WaitForKeyElement.js

Autor
1N07
Version
1.0.1
Erstellt am
01.10.2024
Letzte Aktualisierung
07.10.2024
Lizenz
Unlicense

Library that Exports my simplified vanilla JS version of WaitForKeyElement

which is a simple async function that returns a Promise that resolves to an element by a given selector, when that element is found

Usage:

WaitForKeyElement(querySelectorString, optionalTimeoutInMilliseconds)

Example 1:

WaitForKeyElement('#someElement', 10000).then((foundElement) => {
  //do things with foundElement
});

Example 2:

//in async context*
const foundElement = await WaitForKeyElement('#someElement'));
//do things with foundElement