You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

cursor-position

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

cursor-position

Simple module for getting the current mouse position in element or window.


Version published
Weekly downloads
242
decreased by-15.68%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

cursor-position

Download Count

Demo image

Simple module for getting click/touch position in element or window.

Install

yarn add cursor-position

Or with npm:

npm install cursor-position --save

Usage

Library has only one function: GetCursorPosition(options)

import GetCursorPosition from 'cursor-position'

document.setEventListener('mousemove', () => {
  const {x, y} = GetCursorPosition()
  console.log(x, y)
})

Options

{
    event?: MouseEvent | TouchEvent
    absolute?: boolean
    scroll?: boolean
}
NameTypeRequiredDefaultDescription
eventMouseEvent TouchEventNowindow.eventClick event
absoluteBooleanNotrueDetermine if position must be calculated from body or from parent element
scrollBooleanNofalseDetermine if position must include scroll value

Response

{
  x number
  y number
}

What's new

v1.0.0 (BREAKING CHANGES)

- rewrited library in typescript
- removed eslint
- removed @flow
- changed options
- added some tests (in progress)

v0.0.3

- first release

License

Apache License 2.0

Keywords

FAQs

Package last updated on 16 Jan 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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc