Destroys the current watch or effect from inside the triggered callback.
This is mostly equivalent to destroying the handle returned by watch or effect. However, this method can be called safely from within the callback, even before the handle has been returned.
Example:
const handle = effect((ctx) => {
if (someCondition) {
// Would throw an error if called in the effect's first execution. `handle` has not been returned yet!
// handle.destroy();
// This will always work:
ctx.destroy();
}
});
The context object is available in callback invocations of watch, effect etc.