We should come to a convention about keeping a reference to the object.  Some projects use 

    var that = this;

And that is what I did in graphics/palette.js .  BTW not a big deal.