Skip to content

Commit

Permalink
fix: safely check if IntersectionObserver API supported
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah Grefalda authored and littleninja committed Mar 10, 2021
1 parent 19804bc commit 66cb953
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/auro-back-to-top.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class AuroBackToTop extends LitElement {
}

firstUpdated() {
this.visible = !IntersectionObserver || this.inline;
if (!IntersectionObserver || this.inline) {
this.visible = !('IntersectionObserver' in window) || this.inline;
if (!('IntersectionObserver' in window) || this.inline) {
return
}
const observer = new IntersectionObserver((entries) => {
Expand Down

0 comments on commit 66cb953

Please sign in to comment.