Skip to content

change bgcolor of widget on update? #13

@Fuzzwah

Description

@Fuzzwah

I've created a new widget and that's all working fine; the text in my widget is updating correctly when an event is fired.

I created the new widget by adding this to the app.js file:

(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  Dashing.Quote = (function(_super) {

    __extends(Quote, _super);

    function Quote() {
      return Quote.__super__.constructor.apply(this, arguments);
    }

    Quote.prototype.ready = function() {};

    Quote.prototype.onData = function(data) {};

    return Quote;

  })(Dashing.Widget);

}).call(this);

And adding all the required files to widgets\quote

However, I'd also like the background-color of the widget to change when an update happens. I have the following in my widget's coffee file:

class Dashing.Quote extends Dashing.Widget

  ready: ->
    # This is fired when the widget is done being rendered

  onData: (data) ->
    # Handle incoming data
    # You can access the html node of this widget with `@node`
    # Example: $(@node).fadeOut().fadeIn() will make the node flash each time data comes in.
    @setBackground()

  setBackground: ->
    $(@node).css("background-color", "#000000");

The background-color never changes....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions