DOM Observer API

spy.off()

async

Disables observing for the matched DOM elements and for the components identified by the passed names.

  • Accepts arguments as strings and arrays of strings.
    You can pass component names as individual arguments, as an array, or as a string separated by commas or spaces.
    Each value is seen as a new argument.
  • It is not necessary to wait for the method to be executed using await if not needed.
Example:
spy.off();
// Disables all observers for all components and DOM elements.

spy.off('component_1');
// Disables observers for component 'component_1' for all DOM elements.

spy.off('component_1', 'component_2');
spy.off(['component_1', 'component_2']);
spy.off('component_1, component_2');
spy.off('component_1 component_2');
// Disables observers for components 'component_1' and 'component_2' for all DOM elements.

$('div').spy.off();
// Disables observers for the <div> element for all components.

$('div ?').spy.off();
// Disables observers for all <div> elements for all components.

$('span ?').spy.off('component_1', 'component_2');
// Disables observers for components 'component_1' and 'component_2' for all <span> elements only.

await spy.off();
// Waits for the method to complete its execution.