Reputation: 2980
I am developing a fabric.js
application via meteor
. I have included the file http://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.4.0/fabric.min.js in the project and I try to define a simple canvas as follows,
Template.formatter.rendered = function () {
var canvas = new fabric.Canvas('fabriccanvas'); //<-- error Line
canvas.add(new fabric.Circle({ radius: 30, fill: '#f55', top: 100, left: 100 }));
canvas.selectionColor = 'rgba(0,255,0,0.3)';
canvas.selectionBorderColor = 'red';
canvas.selectionLineWidth = 5;
}
But I get the error Exception from Tracker afterFlush function: fabric.Canvas is not a constructor
. I am very new to these environments and will really appreciate any help from you experts to solve this :) thanks
Upvotes: 0
Views: 1297
Reputation: 11376
Be sure that you have the script into the /client/compatibility
This folder is for compatibility JavaScript libraries that rely on variables declared with var at the top level being exported as globals. Files in this directory are executed without being wrapped in a new variable scope. These files are executed before other client-side JavaScript files.
from doc meteor structuringyourapp
Upvotes: 2