diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-16 19:37:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-17 00:37:01 +0000 |
commit | 4e77741d22778bd09b772fc53f1cbd64107e3d24 (patch) | |
tree | e8010d42ccba5341afd98177d3c1d69d856cbcbd /ext/js/data/permissions-util.js | |
parent | 1e69210b53151f31140bb1fbdc9f3d71fa181630 (diff) |
Even more eslint rules (#696)
* capitalized-comments
* Turn rules on
* Add miscellaneous rules
* More rules
Diffstat (limited to 'ext/js/data/permissions-util.js')
-rw-r--r-- | ext/js/data/permissions-util.js | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/ext/js/data/permissions-util.js b/ext/js/data/permissions-util.js index 097fe34d..1ccc630f 100644 --- a/ext/js/data/permissions-util.js +++ b/ext/js/data/permissions-util.js @@ -40,14 +40,16 @@ function ankiFieldMarkerMayUseClipboard(marker) { * @returns {Promise<boolean>} */ export function hasPermissions(permissions) { - return new Promise((resolve, reject) => chrome.permissions.contains(permissions, (result) => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(result); - } - })); + return new Promise((resolve, reject) => { + chrome.permissions.contains(permissions, (result) => { + const e = chrome.runtime.lastError; + if (e) { + reject(new Error(e.message)); + } else { + resolve(result); + } + }); + }); } /** @@ -58,22 +60,26 @@ export function hasPermissions(permissions) { export function setPermissionsGranted(permissions, shouldHave) { return ( shouldHave ? - new Promise((resolve, reject) => chrome.permissions.request(permissions, (result) => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(result); - } - })) : - new Promise((resolve, reject) => chrome.permissions.remove(permissions, (result) => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(!result); - } - })) + new Promise((resolve, reject) => { + chrome.permissions.request(permissions, (result) => { + const e = chrome.runtime.lastError; + if (e) { + reject(new Error(e.message)); + } else { + resolve(result); + } + }); + }) : + new Promise((resolve, reject) => { + chrome.permissions.remove(permissions, (result) => { + const e = chrome.runtime.lastError; + if (e) { + reject(new Error(e.message)); + } else { + resolve(!result); + } + }); + }) ); } @@ -81,14 +87,16 @@ export function setPermissionsGranted(permissions, shouldHave) { * @returns {Promise<chrome.permissions.Permissions>} */ export function getAllPermissions() { - return new Promise((resolve, reject) => chrome.permissions.getAll((result) => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(result); - } - })); + return new Promise((resolve, reject) => { + chrome.permissions.getAll((result) => { + const e = chrome.runtime.lastError; + if (e) { + reject(new Error(e.message)); + } else { + resolve(result); + } + }); + }); } /** |