Skip to content

Commit

Permalink
docs: improve README
Browse files Browse the repository at this point in the history
Added explanation of secure contexts and the core-js script include (please support core-js if you use it!)
  • Loading branch information
jkruse committed Sep 29, 2024
1 parent f01318d commit 20d6375
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,14 @@ Include these two lines in your `index.html` (if your application only runs on f
<script src="https://unpkg.com/core-js-bundle/minified.js"></script>
<script src="Custom/index.js"></script>

**NOTE that some of these APIs require a secure context, which means they only work when page is accessed using https!** Those APIs are marked with a padlock icon in the demo application.
**NOTE that some of these APIs require a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts), which basically means they only work when page is accessed using https, or from localhost!** Those APIs are marked with a padlock icon in the demo application.

### About the core-js script include

I use recent ECMAScript features in the JavaScript source code for these custom components. When running on a major up-to-date evergreen browser (like Google Chrome, Microsoft Edge or Mozilla Firefox) these features work "out of the box". So if you're sure your application only runs on browsers like that, you can use these components without the core-js script include.

If you're not sure, or you explicitly support older browsers, including core-js will [polyfill](https://developer.mozilla.org/en-US/docs/Glossary/Polyfill) any missing features that *can* be polyfilled. YMMV but this could allow you to use components that would otherwise fail. Including it only adds a ~100 KB download to your page, and does not replace features that are natively supported.

If you *do* use core-js, please [support that project](https://github.com/zloirock/core-js/blob/master/docs/2023-02-14-so-whats-next.md)!

Including core-js will **not** implement API's that are not natively supported in a given browser. Always check the API pages linked above for browser support, and always check the `pbIsSupported` web property of each component at runtime before using it.

0 comments on commit 20d6375

Please sign in to comment.