From d5141a638306733e5b77b1b9969fc1be502e8520 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 23:02:50 +0100 Subject: [PATCH 1/2] Use non-default export --- index.html | 4 ++-- src/index.js | 6 +++--- src/shareon.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 2cef813..c13f161 100644 --- a/index.html +++ b/index.html @@ -109,8 +109,8 @@ diff --git a/src/index.js b/src/index.js index ef7818d..c8b3e45 100644 --- a/src/index.js +++ b/src/index.js @@ -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"; diff --git a/src/shareon.js b/src/shareon.js index a1f818e..bb6a19d 100644 --- a/src/shareon.js +++ b/src/shareon.js @@ -34,7 +34,7 @@ const openUrl = (buttonUrl) => () => { window.open(buttonUrl, "_blank", "noopener,noreferrer"); }; -const initializeShareon = () => { +const init = () => { const shareonContainers = document.querySelectorAll(".shareon"); // iterate over
@@ -90,4 +90,4 @@ const initializeShareon = () => { } }; -export default initializeShareon; +export { init }; From 288fc565284389e550335082244b5ed74b8ca638 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Thu, 10 Feb 2022 23:05:04 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1683f2a..9a38c82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Changed - **BREAKING:** default version of the package doesn't auto-initialize buttons +- **BREAKING:** instead of default export, named exports are now used. If IIFE + is used, the global object's name is now `Shareon`, and it has one `init()` + method - remove mixins, defining the code/styles directly in the files - use [Vite](https://vitejs.dev/) for building, reducing the devDependencies tree and build times drastically