Skip to content

Contributing plugins

rezoner edited this page Feb 9, 2013 · 1 revision

There is not much to explain as the plugins philosophy is much like in jQuery

CanvasQuery.Wrapper.prototype.plugin = function() {

}

Using chainable properties

Within a plugin this is bound to the wrapper - so the chainability is maintained

CanvasQuery.Wrapper.prototype.plugin = function(x, y, w ,h) {
  this.lineWidth(32).strokStyle("#ff0000").strokeRect(x, y, w, h);
}

Accessing original canvas and its context

CanvasQuery.Wrapper.prototype.plugin = function() {
  this.canvas.width = 640;
  this.canvas.height = 480;
  this.context.fillRect(0, 0, 640, 480);
}

Clone this wiki locally