serenity/Base/res/html/misc/unhandledpromisetest.html
Brian Gianforcaro d0a1775369 Everywhere: Fix a variety of typos
Spelling fixes found by `codespell`.
2022-09-14 04:46:49 +00:00

30 lines
866 B
HTML

<!DOCTYPE html>
<html>
<head>
<title>Unhandled Promise rejection with no [[ScriptOrModule]] for the current execution context</title>
</head>
<body>
<button onclick="
Promise.reject(new Error('Success!'));
window.timer = setTimeout(() => {
const element = document.createElement('p');
element.innerText = 'Did not receive unhandledrejection event in 100ms.';
element.style.color = 'red';
document.body.appendChild(element);
}, 100)
">
Click me to cause an unhandled promise rejection.
</button>
<script>
window.onunhandledrejection = (rejectionEvent) => {
clearTimeout(window.timer);
const element = document.createElement("p");
element.innerText = rejectionEvent.reason.message;
element.style.color = "green";
document.body.appendChild(element);
}
</script>
</body>
</html>