Socket
Book a DemoInstallSign in
Socket

drag-file-listener

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drag-file-listener

为元素绑定拖拽事件,并获取拖拽文件

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

The listener element drags and drops into the file and returns the file and directory tree

中文文档 | Englist doc

DEMO

codesandbox

Installation

yarn add drag-file-listener

Using

import Drag from 'drag-file-listener'

const drager = new DragLitener({
  selector: document.querySelector('.drag'),
  drop: ({ file, filesTree }) => {}
})

option

propsmusttypedefaultdescription
selectortrueelement-listen element
droptruefunction-drop event, get the file and directory tree
function({ files, filesTree }){}
  • filesTree
[{
  "name": "文件夹名称",
  "fullPath": "路径",
  "chileren": [],  //子文件夹
  "files":  [],  //当前文件夹下文件
}]

Instance Methods

  • remove listener
drager.removeListener()
  • add listener
drager.addListener()

Keywords

drag

FAQs

Package last updated on 30 Aug 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.