mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-26 20:18:48 +00:00
236 lines
24 KiB
HTML
236 lines
24 KiB
HTML
<!DOCTYPE html>
|
|
<html class="no-js">
|
|
<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>document.documentElement.classList.replace("no-js","js");</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="https://unpkg.com/kotlin-playground@1/dist/playground.min.js" async="async"></script>
|
|
<script type="text/javascript" src="../../../scripts/sourceset_dependencies.js" async="async"></script>
|
|
<link href="../../../styles/style.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">
|
|
<link href="../../../styles/font-jb-sans-auto.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="root">
|
|
<nav class="navigation" id="navigation-wrapper">
|
|
<div class="navigation--inner">
|
|
<div class="navigation-title">
|
|
<button class="menu-toggle" id="menu-toggle" type="button">toggle menu</button>
|
|
<div class="library-name">
|
|
<a class="library-name--link" href="../../../index.html">
|
|
micro_utils.dokka
|
|
</a>
|
|
</div>
|
|
<div class="library-version">
|
|
0.21.1 </div>
|
|
</div>
|
|
<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>
|
|
</div>
|
|
<div class="navigation-controls">
|
|
<button class="navigation-controls--btn navigation-controls--theme" id="theme-toggle-button" type="button">switch theme</button>
|
|
<div class="navigation-controls--btn navigation-controls--search" id="searchBar" role="button">search in API</div>
|
|
</div>
|
|
</nav>
|
|
<div id="container">
|
|
<div class="sidebar" id="leftColumn">
|
|
<div class="sidebar--inner" 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="../-intersection-observer-callback/index.html">IntersectionObserverCallback</a></span></span><span class="token punctuation">)</span><span class="clearfix"><span class="floating-right">(<a href="https://github.com/InsanusMokrassar/MicroUtils/blob/master//common/src/jsMain/kotlin/dev/inmo/micro_utils/common/IntersectionObserver.kt#L81">source</a>)</span></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="../-intersection-observer-callback/index.html">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="../-intersection-observer-callback/index.html">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">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">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 "0px 0px 0px 0px".</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">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"><</span><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-number/index.html">Number</a><span class="token operator">></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">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">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">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"><</span><a href="../-intersection-observer-entry/index.html">IntersectionObserverEntry</a><span class="token operator">></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">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>© 2024 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>
|
|
</div>
|
|
</body>
|
|
</html>
|