Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cameraclick

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cameraclick - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

dist/index.js

2

dist/cameraclick.js

@@ -1,2 +0,2 @@

"use strict";function CameraClick(e,t){let a=!1;const n={width:320,height:480,screenshotCaption:"Screenshot",resolution:"auto",captureCaption:{start:"Start",stop:"Stop"},...t};let o={};const i=e,c=document.createElement("button"),s=document.createElement("video"),r=document.createElement("div"),l=document.createElement("div"),p=(e={})=>{const a={type:"image/jpeg",quality:.85,stopStreamAfterCapture:!0,...e},n=document.createElement("canvas"),{width:i,height:c}=[...o.getVideoTracks()].filter(e=>e.enabled)[0].getSettings();if(n.width=i,n.height=c,n.getContext("2d").drawImage(s,0,0),"function"==typeof t.onCapture){const{type:e,quality:o}=a;t.onCapture({image:n.toDataURL(e,o),cropInfo:{}})}},d=async function(){const e=await navigator.permissions.query({name:"camera"});return(await e).state};return i.className="cameraclick",l.className=`${e.className||"element"}__wrapper`,r.className=`${e.className||"element"}__video-wrapper`,c.className=`${e.className||"element"}__capture`,c.innerHTML=n.screenshotCaption,c.disabled=!0,c.onclick=p,s.autoplay=!0,s.width=n.width,s.height=n.height,s.style.objectFit="cover",l.appendChild(r),l.appendChild(c),i.appendChild(l),{isOpen:()=>a,capture:p,open:async(e,t)=>{"function"==typeof e&&e("granted"===await d()),a=!0,c.disabled=!1,navigator.getUserMedia({video:!0},function(e){r.innerHTML="",r.appendChild(s),s.srcObject=e,o=e,window.mediaTracks=o},function(e){"function"==typeof t&&t(e)})},close:e=>{c.disabled=!0,a=!1,s.srcObject=null,[...o.getTracks()].map(e=>e.stop()),"function"==typeof t.onClose&&e&&t.onClose()}}}module.exports=CameraClick;
"use strict";function CameraClick(e,t){let a=!1;const n={width:320,height:480,screenshotCaption:"Screenshot",resolution:"auto",captureCaption:{start:"Start",stop:"Stop"},...t};let i={};const o=e,c=document.createElement("button"),s=document.createElement("video"),r=document.createElement("div"),l=document.createElement("div"),d=(e={})=>{const a={type:"image/jpeg",quality:.85,stopStreamAfterCapture:!0,...e},n=document.createElement("canvas"),{width:o,height:c}=[...i.getVideoTracks()].filter(e=>e.enabled)[0].getSettings();if(n.width=o,n.height=c,n.getContext("2d").drawImage(s,0,0),"function"==typeof t.onCapture){const{type:e,quality:i}=a;t.onCapture({image:n.toDataURL(e,i),cropInfo:{width:o,height:c}})}},p=async function(){const e=await navigator.permissions.query({name:"camera"});return(await e).state};return o.className="cameraclick",l.className=`${e.className||"element"}__wrapper`,r.className=`${e.className||"element"}__video-wrapper`,c.className=`${e.className||"element"}__capture`,c.innerHTML=n.screenshotCaption,c.disabled=!0,c.onclick=d,s.autoplay=!0,s.width=n.width,s.height=n.height,s.style.objectFit="cover",l.appendChild(r),l.appendChild(c),o.appendChild(l),{isOpen:()=>a,capture:d,open:async(e,t)=>{"function"==typeof e&&e("granted"===await p()),a=!0,c.disabled=!1,navigator.getUserMedia({video:!0},function(e){r.innerHTML="",r.appendChild(s),s.srcObject=e,i=e,window.mediaTracks=i},function(e){"function"==typeof t&&t(e)})},close:e=>{c.disabled=!0,a=!1,s.srcObject=null,[...i.getTracks()].map(e=>e.stop()),"function"==typeof t.onClose&&e&&t.onClose()}}}module.exports=CameraClick;
//# sourceMappingURL=cameraclick.js.map
{
"name": "cameraclick",
"version": "0.2.0",
"version": "0.2.1",
"description": "Simple script to capture images from your browser",

@@ -5,0 +5,0 @@ "main": "dist/cameraclick.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc