mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
chore: upgrade to Node.js v14.9.0 (#25249)
This commit is contained in:
@@ -1068,21 +1068,19 @@ shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readS
|
||||
// cookies
|
||||
// https://github.com/electron/electron/blob/master/docs/api/cookies.md
|
||||
{
|
||||
const { session } = require('electron')
|
||||
|
||||
// Query all cookies.
|
||||
session.defaultSession.cookies.get({})
|
||||
.then((cookies) => {
|
||||
.then(cookies => {
|
||||
console.log(cookies)
|
||||
}).catch((error) => {
|
||||
}).catch((error: Error) => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
// Query all cookies associated with a specific url.
|
||||
session.defaultSession.cookies.get({ url: 'http://www.github.com' })
|
||||
.then((cookies) => {
|
||||
.then(cookies => {
|
||||
console.log(cookies)
|
||||
}).catch((error) => {
|
||||
}).catch((error: Error) => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
@@ -1092,7 +1090,7 @@ shell.writeShortcutLink('/home/user/Desktop/shortcut.lnk', 'update', shell.readS
|
||||
session.defaultSession.cookies.set(cookie)
|
||||
.then(() => {
|
||||
// success
|
||||
}, (error) => {
|
||||
}, (error: Error) => {
|
||||
console.error(error)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
import {
|
||||
desktopCapturer,
|
||||
ipcRenderer,
|
||||
remote,
|
||||
webFrame,
|
||||
@@ -33,16 +34,16 @@ remote.getCurrentWindow().on('close', () => {
|
||||
// blabla...
|
||||
})
|
||||
|
||||
remote.getCurrentWindow().capturePage().then(buf => {
|
||||
fs.writeFile('/tmp/screenshot.png', buf, err => {
|
||||
remote.getCurrentWindow().capturePage().then(image => {
|
||||
fs.writeFile('/tmp/screenshot.png', image.toBitmap(), err => {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
|
||||
remote.getCurrentWebContents().print()
|
||||
|
||||
remote.getCurrentWindow().capturePage().then(buf => {
|
||||
remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => {
|
||||
remote.getCurrentWindow().capturePage().then(image => {
|
||||
remote.require('fs').writeFile('/tmp/screenshot.png', image.toBitmap(), (err: Error) => {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
@@ -107,8 +108,6 @@ crashReporter.start({
|
||||
// desktopCapturer
|
||||
// https://github.com/electron/electron/blob/master/docs/api/desktop-capturer.md
|
||||
|
||||
const desktopCapturer = require('electron').desktopCapturer
|
||||
|
||||
desktopCapturer.getSources({ types: ['window', 'screen'] }).then(sources => {
|
||||
for (let i = 0; i < sources.length; ++i) {
|
||||
if (sources[i].name == 'Electron') {
|
||||
|
||||
Reference in New Issue
Block a user