Search code examples
javascripthtmlcanvaskineticjs

Kineticjs: How to delete a Group and all its Children?


How can I delete a group and all its children?

I found this post How to let a user delete a group of objects in kineticjs? which does not really answers the question.

I would do it like this:

group.destroyChildren();
group.destroy();

Is this the correct way or can I also use only the last line?


Solution

  • You can use group.destroy() alone because group.destroy() also destroys all its children.