New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

elementary-watson

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elementary-watson

The ultimate in DOM Element tracking! You can use it to get the position of a DOM element and to track whether this position changes.

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ElementaryWatson

The ultimate in DOM Element tracking! You can use it to get the position of a DOM element and to track whether this position changes.

Compatibility

This library uses es2015 and esm. You might need to provide transpilation when using it in your projects.

Testing on browserstack

export BROWSERSTACK_USERNAME=<browserstack-username>

export BROWSERSTACK_KEY=<browserstack-access-key>

npm run test:browserstack

How to use

You can get the position of a DOM element:

import ElementaryWatson from 'elementary-watson'
const elementaryWatson = new ElementaryWatson(DOMElement)

const { x, y, height, width, isFixed } = elementaryWatson.getPosition()

isFixed is true when the position of the DOM element is relative to the browser viewport. Otherwise the position is relative to the document. You can track the position of a DOMElement:

elementaryWatson.start(({ x, y, height, width, isFixed }) => {
  // ...
})

The callback is called only when the position changes. You can stop listening to changes using:

elementaryWatson.stop()

FAQs

Package last updated on 31 Jul 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc