Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@dflex/draggable
Advanced tools
npm install @dflex/draggable
DFlex Draggable depends on three principles to achieve DOM interactivity:
import { store, Draggable } from "@dflex/draggable";
Each element should be registered in draggable store in order to be dragged later.
store.register(id: string);
The dragging instance should be created when onmousedown
is fired. So you
initialized the element before start dragging.
const dflexDraggable = new Draggable(id, clickCoordinates);
id: string
registered element-id in the store.coordinate: AxesPoint
is an object with {x: number, y: number}
contains the coordinates of thedflexDraggable.dragAt(x, y);
x: number
is event.clientX, the horizontal click coordinate.y: number
is event.clientY, the vertical click coordinate.dflexDraggable.endDragging();
It's necessary to cleanup the element from store when the element won't be used or will be removed/unmounted from the DOM to prevent memory leaks.
store.unregister(id);
id: string
registered element-id.For documentation, more information about DFlex and a live demo, be sure to visit the DFlex website https://www.dflex.dev/
DFlex is MIT License.
FAQs
Draggable only package for all JavaScript frameworks
We found that @dflex/draggable 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.