-
Notifications
You must be signed in to change notification settings - Fork 27
Storage
Tab Sugar relies on the following storage technologies:
- LocalStorage
- Web SQL Database
- Session storage
LocalStorage is used to persist the tabs captures so that tab previews are available in the dashboard.
It also persists some configuration of the extension, most of which are editable via the Options page.
The following items are stored in the localStorage:
-
initialized
(boolean): if true, then Tab Sugar has already initialized, and as such, has checked all the windows and tabs that were opened -
debug
(boolean): activates/deactivates both the console traces and some visual data in the dashboard -
feature_snapgroups
(boolean): activates/deactivates the group snapping feature while dragging one next to another -
feature_autoresize
(boolean): activates/deactivates the auto resizing feature for tabs inside a group -
feature_tab_preview
(boolean): activates/deactivates the tab preview feature -
group_last_index
(number): the ID of the last group inserted -
db_version
(string): the version of the database schema, used when the db schema must be migrated -
version
(string): the version of the installed extension -
new_window_from_dashboard
(boolean): when set to “true”, the next window creation won’t trigger any database insertion nor dashboard change -
background_page_ready
(boolean): is the background page ready for the dashboard to display groups & tabs?
This one persists all the group & tabs data.
As a relational database, it fits the needs of querying groups and tabs objects.
The database relies on the following schema:
TG01 – Reorganize tabs after tab delete
Name: reorganize_tabs_after_tab_delete
When: AFTER DELETE ON `tabs`
Action: Decrements the index of the following tabs of the same group
TG02 – Reorganize tabs before tab insert
Name: reorganize_tabs_before_tab_insert
When: BEFORE INSERT ON `tabs`
Action: Increments the index of the following tabs of the destination group
TG03 – Reorganize tabs before tab update
Name: reorganize_tabs_before_tab_update
When: BEFORE UPDATE OF `group_id`, `index` ON `tabs`
Conditions: old.`group_id` <> new.`group_id`
Action: Increments the index of the following tabs of the destination group
TG04 – Reorganize tabs after tab update
Name: reorganize_tabs_after_tab_update
When: AFTER UPDATE OF `group_id`, `index` ON `tabs`
Conditions: old.`group_id` <> new.`group_id`
Action: Decrements the index of the following tabs of the source group
TG05 – Delete tabs after group delete
Name: delete_tabs_after_group_delete
When: AFTER DELETE ON `groups`
Action: Deletes the tabs of the deleted group
TG06 – Unselect all tabs of a group before tab selection
Name: unselect_tabs_before_tab_selection
When: BEFORE UPDATE OF `selected` ON `tabs`
Conditions: new.`selected` = 1
Action: Unselects all tabs of the same group
TG07 – Update the updated_at column after group update
Name: update_group
When: AFTER UPDATE ON `groups`
Action: Updates the updated_at
column after group update
TG08 – Update the updated_at column after tab update
Name: update_tab
When: AFTER UPDATE ON `tabs`
Action: Updates the updated_at
column after tab update
TG09 – Update the updated_at column after preview update
Name: update_preview
When: AFTER UPDATE ON `previews`
Action: Updates the updated_at
column after preview update
SessionStorage is used to persist data though the current session and will be lost at browser exit.
This storage is used to map actual windows to their group representations.
-
w10 = "2"
: The window whose id is #10 is mapped to the group whose id is #2 -
w12 = "3"
: I think you got it… -
g2 = "10"
: The group whose id is #2 is mapped to the window whose id is #10 -
g3 = "12"
: Nothing to see here… -
t315 = "2"
: The actual tab whose id is #315 is mapped to the group whose id is #2