繁体   English   中英

如何在Chrome浏览器上使用实验性Wake Lock API?

[英]How to use the experimental Wake Lock API on Chrome browser?

我正在尝试在Chrome 55中运行实验性的Wake Lock API,但似乎我错过了一些东西。

尽管已经设置了@ enable-experimental-web-platform-features标志@ this评论 ,但我无法让它发挥作用。 从规范运行示例返回:

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 - 它存在于铬中,我只是检查了(铬 - 浏览器 - 启动 - 实验 - 网络 - 平台 - 功能)它就在那里,但不是它是否有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM