Skip to content

Commit

Permalink
fix scope polution (#229)
Browse files Browse the repository at this point in the history
globalThis != window
  • Loading branch information
minj authored Feb 18, 2024
1 parent 720fb9c commit df4c08a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/gauge.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ do () ->
lastId = 0
isCancelled = {}

if not requestAnimationFrame
if not window.requestAnimationFrame
window.requestAnimationFrame = (callback, element) ->
currTime = new Date().getTime()
timeToCall = Math.max(0, 16 - (currTime - lastTime))
Expand Down Expand Up @@ -676,7 +676,7 @@ class Donut extends BaseDonut
@options.strokeColor = @strokeGradient(w, h, start, stop)
return @

window.AnimationUpdater =
AnimationUpdater =
elements: []
animId: null

Expand Down Expand Up @@ -720,18 +720,21 @@ if typeof window.define == 'function' && window.define.amd?
Gauge: Gauge,
Donut: Donut,
BaseDonut: BaseDonut,
TextRenderer: TextRenderer
TextRenderer: TextRenderer,
AnimationUpdater: AnimationUpdater
}
)
else if typeof module != 'undefined' && module.exports?
module.exports = {
Gauge: Gauge,
Donut: Donut,
BaseDonut: BaseDonut,
TextRenderer: TextRenderer
TextRenderer: TextRenderer,
AnimationUpdater: AnimationUpdater
}
else
window.Gauge = Gauge
window.Donut = Donut
window.BaseDonut = BaseDonut
window.TextRenderer = TextRenderer
window.AnimationUpdater = AnimationUpdater
13 changes: 8 additions & 5 deletions dist/gauge.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df4c08a

Please sign in to comment.