Search code examples
javascriptcanvaskineticjs

Deleting a Kinetic.Node : remove() or destroy()?


I have an MVC application I'm using KineticJS in one of my views. I want to know what method is better to use if I am deleting a shape or image from a group and eventually from the database. Would it be destroy() or remove()?


Solution

  • With remove, you can remove a node from the canvas but you are able to use it later again if you want. With destroy the node is completely destroyed and can't be reused.

    So, if you want to delete an element completely, use destroy, otherwise use remove.