1

Regenerate nvim config

This commit is contained in:
2024-06-02 03:29:20 +02:00
parent 75eea0c030
commit ef2e28883d
5576 changed files with 604886 additions and 503 deletions

View File

@ -0,0 +1,58 @@
async function defuse(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(ms)
}, ms)
})
}
async function bomb(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(ms)
}, ms)
})
}
async function race() {
return Promise.race([
defuse(500 + Math.ceil(Math.random() * 500)),
bomb(800 + Math.ceil(Math.random() * 200)),
])
}
async function play() {
console.info('Game start!')
let cnt = 0
try {
while (true) {
let ms = await race()
cnt = cnt + ms
console.info(`Defuse after ${ms}ms~`)
}
} catch (msErr) {
cnt = cnt + msErr
console.info(`Bomb after ${msErr}ms~`)
}
console.info(`Game end after ${cnt}ms!`)
await {
then: function(resolve, reject) {
setTimeout(() => {
reject(this.message)
}, 1000)
},
message: 'try to throw an error :)'
}
}
Promise.resolve().then((value) => {
console.info('In next tick')
})
console.info('In main')
play().finally(() => {
console.info('Before throwing UnhandledPromiseRejection on finally!')
})