<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>Summarizer availability then demo</title>
</head>
<body>
<button id="run">run</button>
<pre id="log"></pre>
<script>
var log = document.getElementById("log");
function A(key, value) {
log.textContent += key + ": " + value + "\n";
console.log(key, value);
}
function runDemo() {
log.textContent = "";
var a = false;
var Q = performance.now();
var wB = window.Summarizer;
var k = setTimeout(function () {
debugger;;
if (!a) {
a = true;
A("amZbMl", "timeout");
}
}, 200);
wB["availability"]()["then"](function () {
a = true;
debugger;;
clearTimeout(k);
wB["availability"]()["then"](function (Q) {
A("amZbMl", Q);
})["catch"](function (Q) {
A("amZbMl", "l:"["concat"](Q["message"]));
});
})["catch"](function (Q) {
a = true;
clearTimeout(k);
A("amZbMl", "w:"["concat"](Q["message"]));
})["finally"](function () {
var B = performance["now"]();
A("Z0d17S", Math["round"](B - Q));
});
}
document.getElementById("run").onclick = runDemo;
runDemo();
</script>
</body>
</html>