![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@cevad-tokatli/dom-display-detector
Advanced tools
DOM Display Detector detects an element if it is displayed on the screen or not and calls the given callback method according to the view status.
DOM Display Detector detects an element if it is displayed on the screen or not and calls the given callback method according to the view status.
It is available as a package on NPM for use with a module bundler.
# NPM
$ npm install --save @cevad-tokatli/dom-display-detector
# Yarn
$ yarn add @cevad-tokatli/dom-display-detector
You can simply import the module and call bind
method to bind an element to DOM Display Detector.
import { bind } from '@cevad-tokatli/dom-display-detector'
const el = document.querySelector('#el')
bind(el, () => {
el.classList.add('active')
})
bind(el: Element | HTMLElement | string, onShow: (el: HTMLElement, isInitial: boolean) => void, onHide?: (el: HTMLElement, isInitial: boolean) => void): void
Binds the given element(s) to DOM Display Detector. Every time the element appears on the screen, calls onShow
method and when the element disappears on the screen, calls onHide
method.
As soon as the element is bound, DOM Display Detector directly calls either onShow
or onHide
according to the element view status. (the second argument isInitial
become true
in these kinds of calls.)
bindOnce(el: Element | HTMLElement | string, onShow: (el: HTMLElement) => void, onHide?: (el: HTMLElement) => void): void
Unbinds the element automatically once the element is shown on the screen.
When the element is bound to DOM Display Detector, checks if the element is shown on the screen, and if it is, directly calls onShow
method and unbinds the element, however, if the element is hidden, calls onHide
method and keeps the element bound until it appears on the screen.
unbind(el: Element | HTMLElement | string): void
Unbinds the given element(s).
DOM Display Detector is provided under the MIT License.
FAQs
DOM Display Detector detects an element if it is displayed on the screen or not and calls the given callback method according to the view status.
The npm package @cevad-tokatli/dom-display-detector receives a total of 1 weekly downloads. As such, @cevad-tokatli/dom-display-detector popularity was classified as not popular.
We found that @cevad-tokatli/dom-display-detector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.