5

Github GitHub - nuxodin/lazyfill: Polyfills on demand 💊

 3 years ago
source link: https://github.com/nuxodin/lazyfill
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

pill lazyfill (beta)

Polyfill Service - the lazy way

Polyfills are only loaded when they are needed.
Initial 2Kb to polyfill a lot of Stuff.

Let's assume that your browser does not support the function "String.prototype.at".

> ['a','b','c'].at(-1); // accessing  [].at immediatel loads the polyfill
> 'c'

Ussage

Add this script on the top of your page:

<script src="https://cdn.jsdelivr.net/gh/nuxodin/[email protected]/mod.min.js"></script>

done!

How it works

To every polyfillable property, the scripts adds a getter which synchronously loads the corresponding polyfill.
Of course, we all know that blocking xhr-requests is not nice.
Therefore, the url to the script that should be added to the page is given in the console.

Any help is greatly appreciated.

Thanks / Resources

https://github.com/behnammodi/polyfill

https://polyfill.io/v3/

https://ungap.github.io/

https://github.com/Sylvain59650/all-polyfills

https://vanillajstoolkit.com/polyfills/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK