This describes all of the possible configuration options ín your todesktop.json
.
To avoid confusion, the following terms will be used throughout this file:
- "Project root": this is the parent directory of your
todesktop.json
.
const { app, BrowserWindow, nativeImage, Tray } = require('electron') | |
let tray | |
function createTray() { | |
tray = new Tray(nativeImage.createEmpty()) | |
// ❌ Doesn't work | |
console.log('sync', tray.getBounds()) |
I hereby claim:
To claim this, I am signing this object:
// only polyfill .finished in browsers that already support animate() | |
if (document.body.animate) { | |
// Chrome does not seem to expose the Animation constructor globally | |
if (typeof Animation === 'undefined') { | |
window.Animation = document.body.animate({}).constructor; | |
} | |
if (!('finished' in Animation.prototype)) { | |
Object.defineProperty(Animation.prototype, 'finished', { |
# From https://discussions.apple.com/thread/8115237 | |
from time import sleep | |
while True: | |
sleep(0.00002) |
const isLocalhostName = window.location.hostname === 'localhost'; | |
const isLocalhostIPv6 = window.location.hostname === '[::1]'; | |
const isLocalhostIPv4 = window.location.hostname.match( | |
// 127.0.0.1/8 | |
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ | |
); | |
const isLocalhost = isLocalhostName || isLocalhostIPv6 || isLocalhostIPv4; |
Promise.race([ | |
fetch('/foo'), | |
new Promise((_, reject) => | |
setTimeout(() => reject(new Error('Timeout')), 7000) | |
) | |
]); |
// Your scroll callback will only be called once per frame and only | |
// when the y-position changes. Good for doing DOM work without causing | |
// unnecessary reflows of the document. | |
function onScrollYChange(callback) { | |
let latestKnownScrollY = 0, ticking = false; | |
const scrollChanged = () => { | |
ticking = false; | |
const currentScrollY = latestKnownScrollY; | |
callback(currentScrollY) |
function createSite(name, assignedOptions = {}) { | |
const defaultOptions = { | |
html: 'jade', | |
styles: 'scss', | |
scripts: 'babel', | |
whitespace: '2 spaces', | |
}; | |
const options = Object.assign({}, defaultOptions, assignedOptions); | |
/* |
const transitionToPromise = (el, property, value) => | |
new Promise(resolve => { | |
el.style[property] = value; | |
const transitionEnded = e => { | |
if (e.propertyName !== property) return; | |
el.removeEventListener('transitionend', transitionEnded); | |
resolve(); | |
} | |
el.addEventListener('transitionend', transitionEnded); | |
}); |