MicroUtils/micro_utils.dokka/dev.inmo.micro_utils.common/-intersection-observer/index.html

228 lines
23 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
<title>IntersectionObserver</title>
<link href="../../../images/logo-icon.svg" rel="icon" type="image/svg">
<script>var pathToRoot = "../../../";</script>
<script>const storage = localStorage.getItem("dokka-dark-mode")
if (storage == null) {
const osDarkSchemePreferred = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
if (osDarkSchemePreferred === true) {
document.getElementsByTagName("html")[0].classList.add("theme-dark")
}
} else {
const savedDarkMode = JSON.parse(storage)
if(savedDarkMode === true) {
document.getElementsByTagName("html")[0].classList.add("theme-dark")
}
}
</script>
<script type="text/javascript" src="../../../scripts/sourceset_dependencies.js" async="async"></script>
<link href="../../../styles/style.css" rel="Stylesheet">
<link href="../../../styles/jetbrains-mono.css" rel="Stylesheet">
<link href="../../../styles/main.css" rel="Stylesheet">
<link href="../../../styles/prism.css" rel="Stylesheet">
<link href="../../../styles/logo-styles.css" rel="Stylesheet">
<script type="text/javascript" src="../../../scripts/clipboard.js" async="async"></script>
<script type="text/javascript" src="../../../scripts/navigation-loader.js" async="async"></script>
<script type="text/javascript" src="../../../scripts/platform-content-handler.js" async="async"></script>
<script type="text/javascript" src="../../../scripts/main.js" defer="defer"></script>
<script type="text/javascript" src="../../../scripts/prism.js" async="async"></script>
<script type="text/javascript" src="../../../scripts/symbol-parameters-wrapper_deferred.js" defer="defer"></script>
</head>
<body>
<div class="navigation-wrapper" id="navigation-wrapper">
<div id="leftToggler"><span class="icon-toggler"></span></div>
<div class="library-name">
<a href="../../../index.html">
<span>micro_utils.dokka</span>
</a>
</div>
<div>
0.19.5 </div>
<div class="pull-right d-flex">
<div class="filter-section" id="filter-section">
<button class="platform-tag platform-selector js-like" data-active="" data-filter=":micro_utils.dokka:dokkaHtml/jsMain">js</button>
</div>
<button id="theme-toggle-button"><span id="theme-toggle"></span></button>
<div id="searchBar"></div>
</div>
</div>
<div id="container">
<div id="leftColumn">
<div id="sideMenu"></div>
</div>
<div id="main">
<div class="main-content" data-page-type="classlike" id="content" pageIds="micro_utils.dokka::dev.inmo.micro_utils.common/IntersectionObserver///PointingToDeclaration//-119510368">
<div class="breadcrumbs"><a href="../../../index.html">micro_utils.dokka</a><span class="delimiter">/</span><a href="../index.html">dev.inmo.micro_utils.common</a><span class="delimiter">/</span><span class="current">IntersectionObserver</span></div>
<div class="cover ">
<h1 class="cover"><span>Intersection</span><wbr></wbr><span><span>Observer</span></span></h1>
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword">external </span><span class="token keyword">class </span><a href="index.html">IntersectionObserver</a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">callback<span class="token operator">: </span><a href="../index.html#1479332207%2FClasslikes%2F-119510368">IntersectionObserverCallback</a></span></span><span class="token punctuation">)</span></div><p class="paragraph">This is just an implementation from <a href="https://youtrack.jetbrains.com/issue/KT-43157#focus=Comments-27-4498582.0-0">this commentary</a> of Kotlin JS issue related to the absence of <a href="https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver">Intersection Observer API</a></p></div> </div>
</div>
<div class="tabbedcontent">
<div class="tabs-section" tabs-section="tabs-section"><button class="section-tab" data-active="" data-togglable="CONSTRUCTOR,TYPE,PROPERTY,FUNCTION">Members</button></div>
<div class="tabs-section-body">
<div data-togglable="CONSTRUCTOR">
<h2 class="">Constructors</h2>
<div class="table"><a data-name="664199197%2FConstructors%2F-119510368" anchor-label="IntersectionObserver" id="664199197%2FConstructors%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-togglable="CONSTRUCTOR" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="-intersection-observer.html"><span>Intersection</span><wbr></wbr><span><span>Observer</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="664199197%2FConstructors%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword">constructor</span><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">callback<span class="token operator">: </span><a href="../index.html#1479332207%2FClasslikes%2F-119510368">IntersectionObserverCallback</a><span class="token punctuation">, </span></span><span class="parameter ">options<span class="token operator">: </span><a href="../-intersection-observer-options/index.html">IntersectionObserverOptions</a></span></span><span class="token punctuation">)</span></div><div class="symbol monospace"><span class="token keyword">constructor</span><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">callback<span class="token operator">: </span><a href="../index.html#1479332207%2FClasslikes%2F-119510368">IntersectionObserverCallback</a></span></span><span class="token punctuation">)</span></div></div> </div>
</div>
</div>
</div>
</div>
</div>
</div>
<div data-togglable="PROPERTY">
<h2 class="">Properties</h2>
<div class="table"><a data-name="1268746793%2FProperties%2F-119510368" anchor-label="root" id="1268746793%2FProperties%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="root.html"><span><span>root</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="1268746793%2FProperties%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">val </span><a href="root.html">root</a><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.dom/-element/index.html">Element</a></div><div class="brief "><p class="paragraph">The Element or Document whose bounds are used as the bounding box when testing for intersection. If no root value was passed to the constructor or its value is null, the top-level document's viewport is used.</p></div></div> </div>
</div>
</div>
</div>
</div>
<a data-name="-411264229%2FProperties%2F-119510368" anchor-label="rootMargin" id="-411264229%2FProperties%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="root-margin.html"><span>root</span><wbr></wbr><span><span>Margin</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-411264229%2FProperties%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">val </span><a href="root-margin.html">rootMargin</a><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></div><div class="brief "><p class="paragraph">An offset rectangle applied to the root's bounding box when calculating intersections, effectively shrinking or growing the root for calculation purposes. The value returned by this property may not be the same as the one specified when calling the constructor as it may be changed to match internal requirements. Each offset can be expressed in pixels (px) or as a percentage (%). The default is &quot;0px 0px 0px 0px&quot;.</p></div></div> </div>
</div>
</div>
</div>
</div>
<a data-name="-904371741%2FProperties%2F-119510368" anchor-label="thresholds" id="-904371741%2FProperties%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="thresholds.html"><span><span>thresholds</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-904371741%2FProperties%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">val </span><a href="thresholds.html">thresholds</a><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a><span class="token operator">&lt;</span><span class="token keyword"></span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html">Number</a><span class="token operator">&gt;</span></div><div class="brief "><p class="paragraph">A list of thresholds, sorted in increasing numeric order, where each threshold is a ratio of intersection area to bounding box area of an observed target. Notifications for a target are generated when any of the thresholds are crossed for that target. If no value was passed to the constructor, 0 is used.</p></div></div> </div>
</div>
</div>
</div>
</div>
</div>
</div>
<div data-togglable="FUNCTION">
<h2 class="">Functions</h2>
<div class="table"><a data-name="-1056082641%2FFunctions%2F-119510368" anchor-label="disconnect" id="-1056082641%2FFunctions%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="disconnect.html"><span><span>disconnect</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-1056082641%2FFunctions%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="disconnect.html"><span class="token function">disconnect</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span></div><div class="brief "><p class="paragraph">Stops the IntersectionObserver object from observing any target.</p></div></div> </div>
</div>
</div>
</div>
</div>
<a data-name="-811660624%2FFunctions%2F-119510368" anchor-label="observe" id="-811660624%2FFunctions%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="observe.html"><span><span>observe</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-811660624%2FFunctions%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="observe.html"><span class="token function">observe</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">targetElement<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.dom/-element/index.html">Element</a></span></span><span class="token punctuation">)</span></div><div class="brief "><p class="paragraph">Tells the IntersectionObserver a target element to observe.</p></div></div> </div>
</div>
</div>
</div>
</div>
<a data-name="-787030124%2FFunctions%2F-119510368" anchor-label="takeRecords" id="-787030124%2FFunctions%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="take-records.html"><span>take</span><wbr></wbr><span><span>Records</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="-787030124%2FFunctions%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="take-records.html"><span class="token function">takeRecords</span></a><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html">Array</a><span class="token operator">&lt;</span><span class="token keyword"></span><a href="../-intersection-observer-entry/index.html">IntersectionObserverEntry</a><span class="token operator">&gt;</span></div><div class="brief "><p class="paragraph">Returns an array of IntersectionObserverEntry objects for all observed targets.</p></div></div> </div>
</div>
</div>
</div>
</div>
<a data-name="527766519%2FFunctions%2F-119510368" anchor-label="unobserve" id="527766519%2FFunctions%2F-119510368" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain"></a>
<div class="table-row" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain">
<div class="main-subrow keyValue ">
<div class=""><span class="inline-flex">
<div><a href="unobserve.html"><span><span>unobserve</span></span></a></div>
<span class="anchor-wrapper"><span class="anchor-icon" pointing-to="527766519%2FFunctions%2F-119510368"></span>
<div class="copy-popup-wrapper "><span class="copy-popup-icon"></span><span>Link copied to clipboard</span></div>
</span></span></div>
<div>
<div class="title">
<div class="platform-hinted with-platform-tabs" data-platform-hinted="data-platform-hinted">
<div class="platform-bookmarks-row" data-toggle-list="data-toggle-list"><button class="platform-bookmark" data-filterable-current=":micro_utils.dokka:dokkaHtml/jsMain" data-filterable-set=":micro_utils.dokka:dokkaHtml/jsMain" data-active="" data-toggle=":micro_utils.dokka:dokkaHtml/jsMain">js</button></div>
<div class="content sourceset-dependent-content" data-active="" data-togglable=":micro_utils.dokka:dokkaHtml/jsMain"><div class="symbol monospace"><span class="token keyword"></span><span class="token keyword">fun </span><a href="unobserve.html"><span class="token function">unobserve</span></a><span class="token punctuation">(</span><span class="parameters "><span class="parameter ">targetElement<span class="token operator">: </span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/org.w3c.dom/-element/index.html">Element</a></span></span><span class="token punctuation">)</span></div><div class="brief "><p class="paragraph">Tells the IntersectionObserver to stop observing a particular target element.</p></div></div> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<span class="go-to-top-icon"><a href="#content" id="go-to-top-link"></a></span><span>© 2023 Copyright</span><span
class="pull-right"><span>Generated by </span><a
href="https://github.com/Kotlin/dokka"><span>dokka</span><span class="padded-icon"></span></a></span>
</div>
</div>
</div>
</body>
</html>