Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ev-screen-shot
Advanced tools
web端自定义截屏插件(原生JS版),运行视频:实现web端自定义截屏功能 ,效果图如下:
yarn add web-screen-shot
# or
npm install web-screen-shot --save
由于插件采用原生js编写且不依赖任何第三方库,因此它可以在任意一台支持js的设备上运行。
import ScreenShot from "js-web-screen-shot";
new ScreenShot();
⚠️注意:实例化插件时一定要等dom加载完成,否则插件无法正常工作。
dist
文件夹复制到你的项目中script
标签引入dist目录下的screenShotPlugin.umd.js
文件<script src="./screenShotPlugin.umd.js"></script>
// 截图确认按钮回调函数
const callback = (base64) =>{
console.log(base64);
}
new screenShotPlugin({enableWebRtc: false, completeCallback: callback});
⚠️注意:实例化插件时一定要等dom加载完成,否则插件无法正常工作。
截图插件有一个可选参数,它接受一个对象,对象每个key的作用如下:
enableWebRtc
是否启用webrtc,值为boolean
类型,值为false
则使用html2canvas
来截图completeCallback
截图完成回调函数,值为Function
类型,最右侧的对号图标点击后会将图片的base64地址回传给你定义的函数,如果不传的话则会将图片的base64地址放到sessionStorage
中,你可以通过下述方式拿到他:sessionStorage.getItem("screenShotImg");
level
截图容器层级,值为number类型。canvasWidth
画布宽度,值为number类型。canvasHeight
画布高度,值为number类型。至此,插件的所有使用方法就介绍完了,该插件的Vue3版本,请移步:vue-web-screen-shot
FAQs
web端自定义截屏插件(原生JS版)
The npm package ev-screen-shot receives a total of 0 weekly downloads. As such, ev-screen-shot popularity was classified as not popular.
We found that ev-screen-shot 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.