Use non-default export

pull/45/head
Nikita Karamov 2022-02-10 23:02:50 +01:00
parent 51ec64b236
commit d5141a6383
No known key found for this signature in database
GPG Key ID: 3C8E688C96EEB9C9
3 changed files with 7 additions and 7 deletions

View File

@ -109,8 +109,8 @@
</main>
<script type="module">
import initializeShareon from "./src/shareon.js";
initializeShareon();
import { init } from "./src/shareon.js";
init();
</script>
</body>
</html>

View File

@ -1,9 +1,9 @@
import initializeShareon from "./shareon";
import { init } from "./shareon";
// TODO: update README
const s = document.currentScript;
if (s && s.hasAttribute("init")) {
initializeShareon();
init();
}
export { default } from "./shareon";
export { init } from "./shareon";

View File

@ -34,7 +34,7 @@ const openUrl = (buttonUrl) => () => {
window.open(buttonUrl, "_blank", "noopener,noreferrer");
};
const initializeShareon = () => {
const init = () => {
const shareonContainers = document.querySelectorAll(".shareon");
// iterate over <div class="shareon">
@ -90,4 +90,4 @@ const initializeShareon = () => {
}
};
export default initializeShareon;
export { init };