question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Attempting to close all tabs currently open.

See original GitHub issue

image

Just trying to build a context menu for the tab group so I can right click tabs etc. The issue I’m having is some of the functions don’t seem to fully run. Seems to only close a random amount of tabs that are currently open. I don’t know if it is a timing issue or something else.

I am assuming this might be asking for a bit much but I think Close, Close Others and Close All would be good use cases for other functions an example being VScode or Atom Tabs.

Just realised this line in close causes the delay so maybe you know whats up?

TabGroupPrivate.removeTab.bind(tabGroup)(this, true);

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
maxosprojectscommented, Aug 7, 2018

Have you tried the following?

var tabs = tabGroup.getTabs().slice();
for (var i = 0; i < tabs.length; i++) {
  tabs[i].close();
}

The key is the slice(), which without arguments returns a shallow copy of the array. I think the problem is that you’re iterating an array that loses elements as you go - you close a tab in each iteration and it is removed from the array.

0reactions
maxosprojectscommented, Aug 9, 2018

There are not that many operations that leave that collection intact, so it is a bug in the eachTab() method. Created a PR to fix that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Open and close tabs in Chrome browser - Google Support
At the top right of the tab, click Close "" . Choose a keyboard shortcut: On Windows & Linux, press Ctrl + w....
Read more >
Google Chrome will close all of my tabs and then open again ...
While I am using chrome the tabs will be closed out of no where, windows PowerShell will open for a split second, and...
Read more >
Google Tests New 'Close All Tabs' Pop-up in Chrome for ...
Google has started testing a new "Close all tabs" confirmation dialog box in Chrome for Android; Here is how you can try it...
Read more >
Google Chrome tests warning for closing all tabs on Android
Google is now testing a confirmation prompt for closing tabs when using Chrome on Android. Read on to learn more. Close all taps...
Read more >
How to Save All Open Tabs in Google Chrome - Workona
1. Save all open tabs in Chrome (doesn't work long term) The fastest way to save all open tabs is by using Chrome's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found