utubo / firefox-simple_gesture

๐ŸฆŠAn add-on that adds simple touch gestures for Firfox for Android. Sorry, I only check issues sometimes.
https://addons.mozilla.org/ja/firefox/addon/simple-gesture/
Other
29 stars 1 forks source link

Wrap `browser.tabs.query()` by `SimpleGesture.getTabs()` #52

Open utubo opened 5 years ago

utubo commented 5 years ago

้š›้™ใŒใชใ•ใใ†ใชใฎใงโ†“ใฟใŸใ„ใซใ—ใŸใปใ†ใŒใ„ใ„ใ‹ใช๏ผŸ้–ขๆ•ฐๅใฏใฉใ†ใ—ใ‚ˆใ†โ€ฆ a custom-gesture

let tabs = await SimpleGesture.tabsEval('query');

ใ„ใฃใใ€tabsใซ้™ๅฎšใ—ใชใ„ใปใ†ใŒใ„ใ„๏ผŸ a custom-gesture

let tabs = await SimpleGesture.evalInBackground('browser.tabs.query();');

content.js

SimpleGesture.evalInBackground = async code => {
  return await sendMessage('evalInBackground', { code: code });
}

background.js

evalInBackground = async args => {
  let res = new Function(args.code)();
  if (res.then) {
    return res;
  } else {
    return new Promise((resolve, reject) => { resolve(res); });
  }
}
utubo commented 3 years ago

TabใฎAPIใŒ็›ดใ‚‰ใชใ„ใจใฉใ†ใซใ‚‚ใชใ‚‰ใชใ„ใ‚„โ€ฆ