Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
canvas-rect
Advanced tools
canvas rect drawing on element
npm install canvas-rect --save
<template>
<div ref="el">
</div>
</template>
<script>
import { ref, onMounted } from 'vue'
import DrawRect from 'canvas-rect'
export default {
setup() {
const el = ref(null)
function finish({accords,size}) {
// ...
}
onMounted(()=>{
new DrawRect({
// must be 'div' element
el: el.value,
onFinish: finish,
preserve: false,
}).init()
})
return {
el
}
}
}
</script>
<script>
import React,{ useRef,useEffect } from 'React'
import DrawRect from 'canvas-rect'
export default function Comp() {
const el = useRef(null)
function finish({accords,size}) {
// ...
}
useEffect(()=>{
new DrawRect({
// must be 'div' element
el: el.current,
onFinish: finish,
preserve: false,
}).init()
},[])
return <div ref="el">
</div>
}
</script>
script
tag<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
html,body {
box-sizing: border-box;
background-color: pink;
width: 100%;
}
#container {
display: block;
background-color: white;
margin: 20px auto;
width: 800px;
height: 600px;
}
</style>
</head>
<body>
<div id="container">
</div>
<script src="/path/to/canvas-rect/src/drawRect.js"></script>
<script>
function finish(data) {
console.log(data)
}
new DrawRect({
el: document.querySelector('#container'),
onFinish: finish,
preserve: true,
bgColor: 'yellow'
}).init()
</script>
</body>
</html>
new DrawRect(options: DrawRectOptions).init()
/* interface DrawRectOptions {
// element to draw on,must be `div` element
el: Element;
// canvas background color,default `transparent`
bgColor?: string;
// line width,default `1`
lineWidth?: number;
// line color,default `'#000'`
lineColor?: string;
// if set to `true`,will Keep last drawing on the canvas
preserve?: boolean;
// will be called when mouseup event is emitted
onFinish?: (result: DrawFinishResult)=>any;
} */
MIT
FAQs
canvas rect drawing on element
The npm package canvas-rect receives a total of 0 weekly downloads. As such, canvas-rect popularity was classified as not popular.
We found that canvas-rect 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.