Sha256: 132ee2ad8f1e953ca3e7672f9442fce905db5b9fbb43560f8d1306580b4856fd
Contents?: true
Size: 594 Bytes
Versions: 8
Compression:
Stored size: 594 Bytes
Contents
// Waits for condition to return true. If it returns false initially, this function creates a // MutationObserver that calls body() whenever the contents of the component change. export const observeMutationsUntilConditionMet = (element, condition, body) => { if (condition()) { body(); } else { const mutationObserver = new MutationObserver(() => { if (condition()) { body(); mutationObserver.disconnect(); } }); mutationObserver.observe(element, { childList: true, subtree: true }); } };
Version data entries
8 entries across 8 versions & 2 rubygems