Skip to content

Commit

Permalink
Merge pull request #33 from lucleray/load-script
Browse files Browse the repository at this point in the history
Replace `onload` with `addEventListener`
  • Loading branch information
capaj committed Mar 28, 2023
2 parents b76b16d + b2990fe commit 96abd1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tweet-embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function addScript(src: string, cb: () => any) {
callbacks.push(cb)
var s = document.createElement('script')
s.setAttribute('src', src)
s.onload = () => callbacks.forEach((cb) => cb())
s.addEventListener('load', () => callbacks.forEach((cb) => cb()), false)
document.body.appendChild(s)
} else {
callbacks.push(cb)
Expand Down

0 comments on commit 96abd1f

Please sign in to comment.