Remove Add Event Listeners?
Author: fadi-georgeCreated Jul 3, 2024Updated Dec 16, 2024
Hello, I was looking to using this package in an effort to replace Dexie with a smaller package. When I profiling idb against Dexie and other options, I noticed that it adds way more event listeners than expected.
I made a simple setup here: https://github.com/fadi-george/idb-test
I noticed that with idb, I see a lot of listeners being added.
And it can be up to 2x the number of listeners compared to Dexie.
Basic IndexDB for comparison:
Which brings me to my point where I copied over the idb src files and changed the event listeners to event handlers. Things like:
request.addEventListener('upgradeneeded', (event) => { ...being changed into
request.onupgradeneeded = (event) => { ...And then saw an obvious reduction in the listener count.
So maybe it would be good to switch all the event listeners to event handlers.
Source: jakearchibald/idb