Add default export for initializeShareon.

It allows to initialize share button after window.load, for example on SPA dynamic element.
pull/12/head
amiceli 2020-07-14 17:47:27 +02:00
parent 51b918ef94
commit 4db5ac324b
1 changed files with 5 additions and 1 deletions

View File

@ -44,7 +44,7 @@ function initShareonChild(child: HTMLElement, preset: PublishPreset) {
} }
} }
window.onload = () => { const initializeShareon = () : void => {
const shareonContainers = document.getElementsByClassName('shareon'); const shareonContainers = document.getElementsByClassName('shareon');
for (let i = 0; i < shareonContainers.length; i += 1) { for (let i = 0; i < shareonContainers.length; i += 1) {
@ -70,3 +70,7 @@ window.onload = () => {
} }
} }
}; };
window.onload = () => { initializeShareon(); };
export default initializeShareon;