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

tabs.removeはarrayを渡したほうがいいかな #51

Closed utubo closed 4 years ago

utubo commented 5 years ago
closeAll: async arg => {
  const tabs = await browser.tabs.query({});
  for (let i = tabs.length - 1; 0 <= i; i --) {
    browser.tabs.remove(tabs[i].id);
  }
}

closeAll: async arg => {
  const tabs = await browser.tabs.query({});
  const ids = [];
  for (let tab of tabs) {
    ids.push(tab.id);
  }
  browser.tabs.remove(ids);
}
utubo commented 5 years ago
getTabs: async filter => {
  const all = await browser.tabs.query({});
  const tabs = [];
  for (let tab of all) {
    if (filter(tab)) tabs.push(tab);
  }
  return tabs;
},
getTabIds: tabs => {
  const ids = [];
  for (let tab of tabs) {
    ids.push(tab.id);
  }
  return ids;
}
closeAll: async arg => {
  const tabs = await exec.getTabs(tab => true);
  browser.tabs.remove(exec.getTabIds(tabs));
}

これはやりすぎか…