Skip to content

Commit

Permalink
feat: make sure extension hasn't been added before injecting
Browse files Browse the repository at this point in the history
  • Loading branch information
ntwigs committed Nov 28, 2022
1 parent 682c8c0 commit 4db8a73
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/snow/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
import { Canvas } from './main/canvas'
new Canvas()
import { LET_IT_SNOW_CLASS } from './main/canvas/selectors'

const hasCanvas = () => {
const canvas = document.querySelector(`.${LET_IT_SNOW_CLASS}`)
return !!canvas
}

const snow = () => {
if (hasCanvas()) return
new Canvas()
}

snow()

0 comments on commit 4db8a73

Please sign in to comment.