Skip to content

Commit

Permalink
Update JSDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr committed Jul 21, 2024
1 parent ac06e48 commit cbb0592
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/js/exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export function textFileDownload(filename, text) {
/**
* Request Host Permissions
* @function requestPerms
* @return {chrome.permissions.request}
* @return {Promise<*|chrome.permissions.request>}
*/
export async function requestPerms() {
return await chrome.permissions.request({
Expand All @@ -268,7 +268,7 @@ export async function requestPerms() {
/**
* Check Host Permissions
* @function checkPerms
* @return {Boolean}
* @return {Promise<*|Boolean>}
*/
export async function checkPerms() {
const hasPerms = await chrome.permissions.contains({
Expand Down
2 changes: 1 addition & 1 deletion src/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ async function filterClick(event) {
* @function saveEditing
* @param {MouseEvent} event
* @param {String} idx
* @return {Boolean}
* @return {Promise<*|Boolean>}
*/
async function saveEditing(event, idx) {
event.preventDefault() // block dragStart if editing
Expand Down
3 changes: 1 addition & 2 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,11 @@ function extractURLs(text) {

/**
* Grant Permissions Click Callback
* Promise from requestPerms is ignored so we can close the popup immediately
* @function grantPerms
* @param {MouseEvent} event
*/
export async function grantPerms(event) {
console.debug('grantPerms:', event)
requestPerms()
requestPerms() // promise ignored so we can call window.close()
window.close()
}
28 changes: 13 additions & 15 deletions src/js/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,18 @@ async function onInstalled(details) {
const githubURL = 'https://github.com/cssnr/link-extractor'
const installURL = 'https://link-extractor.cssnr.com/docs/?install=new'
const uninstallURL = new URL('https://link-extractor.cssnr.com/uninstall/')
const { options, patterns } = await Promise.resolve(
setDefaultOptions({
linksDisplay: -1,
flags: 'ig',
lazyLoad: true,
removeDuplicates: true,
defaultFilter: true,
saveState: true,
linksTruncate: true,
linksNoWrap: false,
contextMenu: true,
showUpdate: false,
})
)
const { options, patterns } = await setDefaultOptions({
linksDisplay: -1,
flags: 'ig',
lazyLoad: true,
removeDuplicates: true,
defaultFilter: true,
saveState: true,
linksTruncate: true,
linksNoWrap: false,
contextMenu: true,
showUpdate: false,
})
console.log('options, patterns:', options, patterns)
if (options.contextMenu) {
createContextMenus(patterns)
Expand Down Expand Up @@ -321,7 +319,7 @@ async function injectFunction(func, args) {
* Set Default Options
* @function setDefaultOptions
* @param {Object} defaultOptions
* @return {Object}
* @return {Promise<*|Object>}
*/
async function setDefaultOptions(defaultOptions) {
console.log('setDefaultOptions', defaultOptions)
Expand Down

0 comments on commit cbb0592

Please sign in to comment.