W3C home > Mailing lists > Public > public-device-apis-log@w3.org > May 2019

[wake-lock] New API with AbortController is not intuitive for developers. (#214)

From: Mrunal Kapade via GitHub <sysbot+gh@w3.org>
Date: Thu, 16 May 2019 18:52:36 +0000
To: public-device-apis-log@w3.org
Message-ID: <issues.opened-445108018-1558032755-sysbot+gh@w3.org>
mrunalk has just created a new issue for https://github.com/w3c/wake-lock:

== New API with AbortController is not intuitive for developers. ==
Looking at the examples let's say the first one,
  const controller = new AbortController();
  const signal = controller.signal;

  WakeLock.request("screen", { signal });

  setTimeout(() => controller.abort(), minutes * 60 * 1000);
It seems the whole API is implemented around AbortController. I don't see many API's in Chrome using AbortController yet. If you look at the previous API it seems much more readable and easy to use IMO although I definitely think reliance on Navigator interface and WakeLockRequest should go and request() and cancel() should be the only methods as part of WakeLock interface.

Does anyone else also think the same?

Please view or discuss this issue at https://github.com/w3c/wake-lock/issues/214 using your GitHub account
Received on Thursday, 16 May 2019 18:52:38 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:56 UTC