kytta / shareon

📯 Lightweight, stylish, and ethical share buttons for popular social networks
https://shareon.js.org/
MIT License
465 stars 25 forks source link

Export the `shareon` function #14

Closed kytta closed 4 years ago

kytta commented 4 years ago

original PR: #13 by @amiceli

This PR adds the possibility to postpone auto-init of shareon and/or re-run it (see also #11).

Showcase

<!-- load the version without auto-init -->
<script src=".../shareon.noinit.min.js"></script>
// init when needed
if (timeToInitShareon) {
  shareon();
}

The no-init workflow could also be the default for CommonJS/ESM versions:

import shareon from 'shareon';

if (timeToInitShareon) {
  shareon();
}