Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
🐾 拖拽移动设备上的任意元素
使用 npm:
$ npm install mydrag --save
使用 yarn:
$ yarn add mydrag
使用 bower:
$ bower install liuyib/mydrag --save
使用 jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/mydrag/dist/mydrag.min.js"></script>
使用 unpkg CDN:
<script src="https://unpkg.com/mydrag/dist/mydrag.min.js"></script>
首先,引入 mydrag.js
:
import Mydrag from 'mydrag'; // ES6
// 或
const Mydrag = require('Mydrag'); // CommonJS
// 或
<script src="https://cdn.jsdelivr.net/npm/mydrag/dist/mydrag.min.js"></script>
// 或
<script src="https://unpkg.com/mydrag/dist/mydrag.min.js"></script>
然后,准备一个元素:
<div id="drag"></div>
最后,使用:
// 用例 1(使用 new)
new Mydrag('#drag');
// 用例 2(不用 new)
Mydrag('#drag');
// 用例 3(传递参数)
Mydrag('#drag', {
initX: 100, // 100 px
initY: 100 // 100 px
});
Mydrag(selector, options)
true
)5
)
数值越大,缓冲动画的速度减小越慢。
x
坐标(可选。默认:0
,单位:px
)y
坐标(可选。默认:0
,单位:px
)10
,单位:px
)安装所需依赖:
$ npm install
修改代码之前,请执行:
$ npm run dev
该指令的作用是:自动监听代码变动,并打包生成
mydrag.min.js
。
或者不执行 npm run dev
,当修改完代码时,执行:
$ npm run build
编写测试之前,请执行:
$ npm run test
查看测试覆盖率,请在浏览器中运行 coverage/lcov-report
目录下的 index.html
文件。
该文件和目录需要执行
npm run test
才会生成。
FAQs
🐾 Drag any element on mobile device
We found that mydrag 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.