我正在尝试在 Chrome 55 中运行实验性 Wake Lock API,但似乎遗漏了一些东西。
尽管按照建议设置了标志 --enable-experimental-web-platform-features @ this comment ,我无法让它发挥作用。运行 example from the spec返回:
navigator.getWakeLock("screen").then(function(wakeLock) {
var request = wakeLock.createRequest();
setTimeout(function() {
request.cancel();
}, 1000);
});
Uncaught TypeError: navigator.getWakeLock is not a function
at <anonymous>:1:11
我错过了什么?
最佳答案
请注意设计文档:https://docs.google.com/document/d/1KbIENP0wgxtSXDQFn9PbHZ_tAKZfR1Y8u4Hst8LpeaA/edit
screen.keepAwake - 它存在于 chromium 中,我刚刚检查了 (chromium-browser --enable-experimental-web-platform-features) 它就在那里,但不知道它是否有用。
关于javascript - 如何在 Chrome 浏览器上使用实验性的 Wake Lock API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41810241/