Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 974 Bytes

whenVisible.md

File metadata and controls

22 lines (16 loc) · 974 Bytes

whenVisible

Monitor an HTMLElement to be notified when it is visible

Parameters

Name Type Description Status Default
elm { HTMLElement } The element to monitor required
cb { Function } An optional callback to call when the element is visible optional null

Return { (Promise) } The promise that will be resolved when the element is visible

Example

	import whenVisible from 'coffeekraken-sugar/js/dom/whenVisible'
whenVisible(myCoolHTMLElement).then((elm) => {
		// do something with your element that is now visible
});

Author : Olivier Bossel [email protected] https://olivierbossel.com