Skip to content

Commit

Permalink
Simplify existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
nanaya committed Jan 7, 2025
1 parent 8a72a2a commit f713a0e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions resources/js/core-legacy/changelog-chart-loader.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
import ChangelogChart from 'charts/changelog-chart'

export default class ChangelogChartLoader
container: document.getElementsByClassName('js-changelog-chart')

constructor: ->
$(window).on 'resize', @resize
$(document).on 'turbo:load', @initialize


initialize: =>
container = @container[0]
@container = document.querySelector('.js-changelog-chart')

return unless container?
return unless @container?

# reset existing chart
container.innerHTML = ''
@container.innerHTML = ''

container._chart = new ChangelogChart container
container._chart.loadData()
@container._chart = new ChangelogChart @container
@container._chart.loadData()


resize: =>
@container[0]?._chart.resize()
@container?._chart.resize()

0 comments on commit f713a0e

Please sign in to comment.