In my application, I have multiple Fabric.js canvases, There is no limit on the number of canvases. I\'ll render heavy JSON via loadFromJson
method of Fabric.js.
You might be interested in 3 things (in the order of significance/destruction):
canvas.clear()
— removes all canvas objects from it.
canvas.dispose()
— removes all canvas objects AND removes all event listeners
$(canvas.wrapperEl).remove()
(using jQuery for illustrative purposes) — to remove canvas wrapper element (which contains upper and lower canvases used by Fabric). This can be done AFTER you call dispose, if the goal is to completely remove Fabric canvas from a document.