Scroll-Sense is a chrome extension that helps you in browsing the internet mindfully.
It shows you how much distance you have travelled with your fingers by swiping. It will show you distance covered per site.
Dev-process
window.scrollY gives distance from top
So when going up it will give less values
The scrollend event doesn't catch the scenario when the user keeps his hand still on the touchpad. This event gets triggered if only I leave the touchpad.
I was trying to find way to return a value which was calculated in setTimeout. You can make it a promise and then resolve using the calc. Simply returning synchronously is not possible in something async like setTimeout. Using customEvent is better.
px are dependent on device pixel ratio. Getting exact distance metres is impossible.
initial logic(in initial commits) for counting distance was wrong. We should accumulate deltas per scroll because users can change direction faster than 150ms by keeping track of last Y.
Max Write Operations Limit with Sync. So used local extension storage.