lyzhng / tabble

Table of Contents Tab
1 stars 0 forks source link

Add event handlers to update the tab list #10

Closed lyzhng closed 4 years ago

lyzhng commented 4 years ago

When a new tab is created and the user goes back to Tabble, it should be updated with that new tab.

lyzhng commented 4 years ago

Added onActivated handler in 7ed9319e06388d7f4b55bcb1a23dc02da247c26e.

lyzhng commented 4 years ago

There is currently a bug as onActivated may result in about:blank first. MDN web docs state that it:

Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to tabs.onUpdated events to be notified when a URL is set.

lyzhng commented 4 years ago

On a second thought, this method may not be the best way as it is under the assumption that the user is on Tabble and will not right-click to close another tab. Tabble will not refetch the tab list if this happens.

I had hoped that I wouldn't need to utilize a lot of event handlers (so that users' computers won't combust 😓). It seems that if I want to consider more use cases, I should go this route.

lyzhng commented 4 years ago

Resolved. As of ce11dfc011096e2492e3b5afb236959e798b405b, all necessary event handlers are added. The addon page will react accordingly! 😃