Sloth now has an option page to tweak its behavior

in #utopian-io5 years ago (edited)

Sloth is a Chromium extension that ensures that tabs are lazily loaded. That is, when the browser starts, tabs from the previous session are not loaded immediately. They are loaded only when the user clicks on the tab (or somehow activates the tab). This speeds up the browser tremendously when there are lot of tabs open.

Sloth by default tries hard to ensure that no tabs are loaded. To prevent the last active tab from loading, Sloth creates a new empty tab and focusses it.

However, this behavior may not be suitable for everyone. Users had requested that this feature be made optional.

Hence, I added an options page to Sloth, with a toggle for enabling / disabling the "new tab feature":


Asynchronous storage and Sloth

Adding the options page for Sloth was not trivial. Unlike other extensions Sloth has some special needs.

Sloth has to kick-in and do its magic when the browser is still starting. That means, as quick as possible and in the on-start handler. However, the recommended "options" storage for Chromium has an Asynchronous API. That means the storage can only be accessed outside of the "on-start" handler.

To solve this problem, I used the localStorage API, instead of the default API. The localStorage API has a synchronous API and hence suitable for Sloth.

Installation is easier now

Since the time of my last update here, I have published the extension on the Chrome Store here. There are quite a few users already and nobody has complained so far, so I suppose the extension is working for them! If you try it, let me know how it goes in the comments below.

Note: The changes described here are live as part of the v0.2 release.

Posted on - Rewarding Open Source Contributors


Thank you for the contribution. It has been approved.

You can contact us on Discord.

Thank you too @vladimir-simovic for taking a look!

Hey @hrj I am @utopian-io. I have just upvoted you!


  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!


Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord

Coin Marketplace

STEEM 0.19
TRX 0.06
JST 0.026
BTC 23123.71
ETH 1584.36
USDT 1.00
SBD 2.49