Skip to content

Instantly share code, notes, and snippets.

@scr512
Created September 18, 2013 15:46
Show Gist options
  • Save scr512/6611171 to your computer and use it in GitHub Desktop.
Save scr512/6611171 to your computer and use it in GitHub Desktop.
Modified meter.coffee to allow for custom background color via JSON PUT.
class Dashing.Meter extends Dashing.Widget
@accessor 'value', Dashing.AnimatedValue
constructor: ->
super
@observe 'value', (value) ->
$(@node).find(".meter").val(value).trigger('change')
ready: ->
meter = $(@node).find(".meter")
meter.attr("data-bgcolor", meter.css("background-color"))
meter.attr("data-fgcolor", meter.css("color"))
meter.knob()
onData: (data) ->
if data['background-color']
$(@get('node')).css 'background-color', data['background-color']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment