stickymate
stickymate copied to clipboard
Future-proof this library
Your library is great, but it lacks of some key features.
- It should be bundled using rollup.js
- should be writting in TypeScript (nice to have, not must have)
- should not be included but rather be exported, so we can "import" or "require" it. While it is already importable, its a self running library, which runs as soon as its included.
Stickymate should export itself als "stickymate" and have an init
method, maybe with configurable parameters.
So, in a modern setup, people could decide (thanks to rollup) if they like to include it as module, umd, amd etc.
import stickymate from "stickymate.js"
stickymate.init({ options: [optional] });
Rollup takes care of transpiling and its super easy to setup. TypeScript might be overkill for this small module with only one export.
Porting this to a solid rollup config is done very quickly.
Since I think you never worked with it, here a super simple setup: https://hackernoon.com/building-and-publishing-a-module-with-typescript-and-rollup-js-faa778c85396
And here is a perfect starter lib, which help you building a esm (modern import) or umd (including
After this is done, we could write some tests for it using JEST for example, but this should be done as a next step. Sorry for those many comments here now. :)
I think, this library could gain a lot more attention when its published and maintained more modern. I also would drop IE11 and EdgeHTML support and drop support for old browsers without IntersectionObserver.
Every modern setup has a IntersectionObserver polyfill. We should stop support dead old browsers.
Support for it is already good enough. https://caniuse.com/?search=IntersectionObserver
https://caniuse.com/?search=MutationObserver
And support for flat
is also enough.
https://caniuse.com/?search=.flat
https://caniuse.com/?search=.reduce
https://caniuse.com/?search=.assign
Most things, which used to be polyfilled are working for nearly everybody.
@Hirbod big thanks for your recommendations, materials and participation in the life of the project! I keep working on it.
I'll help out as soon as I have some more time :)