class TimerApp
{
internal static async void Start()
{
HtmlElement waiting = HtmlDocument.Current.GetElementById("waiting");
IDisposable timer = HtmlWindow.Current.AdviseInterval(
delegate ()
{
waiting.InnerText += ".";
}, 500);
await HtmlWindow.Current.AdviseTimeout(10000);
timer.Dispose();
HtmlDocument.Current.GetElementById("status").InnerText = "Stopped";
waiting.InnerText = null;
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="x-ua-compatible" content="IE=11;IE=10;IE=9;IE=8;IE=7" />
<script type="text/javascript" language="javascript" src="js/timer.js"></script>
</head>
<body onload="javascript:StartScript()">
Timer.html - check setInterval & clearInterval. await Timeout
<table cellpadding="0" cellspacing="0">
<tr>
<td id="status">
Waiting
</td>
<td id="waiting"></td>
</tr>
</table>
</body>
</html>