Skip to content

SVG framework function: pauseObserver

This tutorial is part of Iconify SVG Framework functions tutorial.

Function pauseObserver() tells SVG framework to temporarily stop watching HTML element for icon placeholders.

Use this function when you need to do a lot of DOM manipulation and you want to prevent SVG framework from scanning DOM until you resume observing using resumeObserver().

Usage

Function has the following optional parameter:

  • root, HTMLElement. Element to pause observing. If missing, SVG framework will pause all active observers.

Example

js// Pause observer
Iconify.pauseObserver();

// Do some heavy DOM manipulation
// ...
// ...

// Resume observer
Iconify.resumeObserver();

Notes

  • Pause tracker is a number, it increases with every call. If you call pauseObserver() multiple times, you need to call resumeObserver() the same amount of times to resume observer.
  • If you are removing custom node and do not plan to re-use it, you need to stop observer, not pause it. See stopObserving().

Released under the Apache 2.0 License.