![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.
dnd-multi-backend
Advanced tools
This project is a Drag'n'Drop backend compatible with DnD Core. It enables your application to use different DnD backends depending on the situation. This package is completely frontend-agnostic, you can refer to this page for frontend-specific packages. This means if your front-end is not yet supported, you'll have to roll out your own.
npm install dnd-multi-backend
You should only use this package if your framework is not in the supported list:
In this case, you will need to write a custom pipeline including as many dnd-core
backends as you wish. See also the examples for more information.
import { createDragDropManager } from 'dnd-core';
import MultiBackend from 'dnd-multi-backend';
// Define the backend and pipeline
class HTML5Backend {
constructor(manager) {
this.manager = manager;
}
setup() {}
teardown() {}
connectDragSource(sourceId, node, options) {
...
return () => {};
}
connectDragPreview(previewId, node, options) {
...
return () => {};
}
connectDropTarget(targetId, node, options) {
...
return () => {};
}
}
...
const pipeline = {
backends: [
{
backend: HTML5Backend,
transition: MouseTransition,
},
{
backend: TouchBackend,
preview: true,
transition: TouchTransition,
},
],
};
// Setup the manager
const manager = createDragDropManager(MultiBackend, {}, pipeline);
const registry = manager.getRegistry();
// Setup your DnD logic
class Source {
...
canDrag() {}
beginDrag() {}
isDragging() {}
endDrag() {}
}
class Target {
...
canDrop() {}
hover() {}
drop() {}
}
// Define the DnD logic on the manager
const Item = 'item';
const src = new Source();
const dst = new Target();
const srcId = registry.addSource(Item, src);
const dstId = registry.addTarget(Item, dst);
// Link the DOM with the logic
const srcP = document.createElement('p');
const srcTxt = document.createTextNode('Source');
srcP.appendChild(srcTxt);
document.body.appendChild(srcP);
manager.getBackend().connectDragSource(srcId, srcP);
const dstP = document.createElement('p');
const dstTxt = document.createTextNode('Target');
dstP.appendChild(dstTxt);
document.body.appendChild(dstP);
manager.getBackend().connectDropTarget(dstId, dstP);
MIT, Copyright (c) 2016-2019 Louis Brunner
FAQs
Multi Backend system compatible with DnD Core / React DnD
The npm package dnd-multi-backend receives a total of 65,124 weekly downloads. As such, dnd-multi-backend popularity was classified as popular.
We found that dnd-multi-backend demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.