Sloth now has an option page to tweak its behavior

4년 전

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":

sloth-cropped.png

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 chrome.storage 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 Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
STEEMKR.COM IS SPONSORED BY
ADVERTISEMENT
Sort Order:  trending

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

·
  ·  4년 전

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

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

Achievements

  • 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!

mooncryption-utopian-witness-gif

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