title: adding custom attributes to fabricjs object
body: <p>Im trying to add a custom attribute to a fabric js object that i have:</p>
  
  <pre><code>var trimLine = new fabric.Rect({
      width: Math.round(obj.box_dimensions.box.width,2),
      height: Math.round(obj.box_dimensions.box.height,2),
      strokeWidth: 1,
      stroke: 'rgb(255,2,2)',
      fill: '',
      selectable: false
  });
  </code></pre>
  
  <p>so thats my rectangle im trying to add and i want to pass a name or id in it to be able to identify it later when i get the canvas object and convert it to a json.</p>
  
  <p>I have tried doing </p>
  
  <pre><code>var trimLine = new fabric.Rect({
      width: Math.round(obj.box_dimensions.box.width,2),
      height: Math.round(obj.box_dimensions.box.height,2),
      strokeWidth: 1,
      stroke: 'rgb(255,2,2)',
      fill: '',
      selectable: false,
      name: trimLine
  });
  
  canvas.add(trimLine);
  canvas.renderAll();
  </code></pre>
  
  <p>and it did not work i also tried to do </p>
  
  <pre><code> trimline.name = 'trimLine'
  </code></pre>