okfn/annotator — pull request #226 by nickstenning (2013-06-25 07:48:17+00:00)
Title: Add a #destroy() method to Annotator

A number of issues have been filed against Annotator (#168, #202, #213)
requesting the ability to recreate an Annotator instance or reload some
component of Annotator. This has been made difficult by the lack of a clean way
of removing existing Annotator instances from the page.

This PR adds a `destroy()` method to Annotator which uses a new `removeEvents()`
method of Delegator to do the heavy lifting. Plugins have a default `destroy()`
method which they can override to do plugin-specific cleanup: see the Filter
plugin for an example.

This pull request also includes a small commit that adds basic instance tracking
to Annotator, which can be useful for similar reasons to the `destroy()` method.