Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to take screenshot of desktop using electron js

const { desktopCapturer } = require('electron')

document.getElementById('screenshot-button').addEventListener('click', () => { // The button which takes the screenshot
    desktopCapturer.getSources({ types: ['screen'] })
        .then( sources => {
            document.getElementById('screenshot-image').src = sources[0].thumbnail.toDataURL() // The image to display the screenshot
        })
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to run javascript in chrome 
Javascript :: call a function multiple times 
Javascript :: mongoose multiple populate 
Javascript :: how to change the background color of html in javascript 
Javascript :: ts node cannot use import statement outside a module 
Javascript :: bootstap jquery 
Javascript :: jquery select first matching element 
Javascript :: momentjs format date 
Javascript :: javascript .foreach 
Javascript :: Sorting an array of objects by property values 
Javascript :: largest sum contiguous subarray javascript 
Javascript :: laravel ajax post data to controller 
Javascript :: axios middleware 
Javascript :: react dont render component until loaded 
Javascript :: Use Multiple Conditional Ternary Operators Javascript 
Javascript :: js copy array into another 
Javascript :: node js run for loop asynchronously 
Javascript :: npm i postman 
Javascript :: Moment.js: Date between dates 
Javascript :: javascript redirect with extra url arguments 
Javascript :: memory leak in javascript 
Javascript :: regex usage 
Javascript :: searching in json array mongodb 
Javascript :: debug react routes 
Javascript :: angular build production 
Javascript :: javascript remove element from object 
Javascript :: php watermark facile 
Javascript :: mongoose countdocuments 
Javascript :: nodejs call api 
Javascript :: js get json object keys 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =