destroy
Removes listeners held by this object.
Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
handler = handler && handler.destroy();Content copied to clipboard