Sha256: eea511e5cb5a1bfc9523cdc96c727fb4d5497e1eb07d2911c664fb8fd3f3183e

Contents?: true

Size: 664 Bytes

Versions: 8

Compression:

Stored size: 664 Bytes

Contents

class Dashing.HotState extends Dashing.Widget

  constructor: ->
    super

  onData: (data) ->
    return if not @state
    state = @state.toLowerCase()

    if [ 'critical', 'warning', 'ok', 'unknown' ].indexOf(state) != -1
      backgroundClass = "hot-state-#{state}"
    else
      backgroundClass = "hot-state-neutral"

    lastClass = @lastClass

    if lastClass != backgroundClass
      $(@node).toggleClass("#{lastClass} #{backgroundClass}")
      @lastClass = backgroundClass

      audiosound = @get(state + 'sound')
      audioplayer = new Audio(audiosound) if audiosound?
      if audioplayer
        audioplayer.play()

  ready: ->
    @onData(null)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dashing-contrib-0.2.9 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.8 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.7 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.6 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.5 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.4 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.3 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee
dashing-contrib-0.2.2 lib/dashing-contrib/assets/widgets/hot_state/hot_state.coffee