How to manage memory in case of multiple fabric js canvas?

纵然是瞬间 提交于 2019-12-03 08:38:04

You might be interested in 3 things (in the order of significance/destruction):

  1. canvas.clear() — removes all canvas objects from it.

  2. canvas.dispose() — removes all canvas objects AND removes all event listeners

  3. $(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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!