TLDR: Use for...of
instead of forEach()
in asynchronous code.
For legacy browsers, use for...i
or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
import os | |
import sys | |
import vlc | |
import pygame | |
def callback(self, player): | |
print 'FPS =', player.get_fps() | |
print 'time =', player.get_time(), '(ms)' |
#!/usr/bin/env node | |
const fs = require('fs'); | |
const http = require('http'); | |
const home = process.env.HOME; | |
const options = { | |
host: 'example.com', | |
path: '/', |
{ | |
"compilerOptions": { | |
/* Basic Options */ | |
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, | |
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, | |
"lib": [ | |
"esnext", | |
"dom" | |
] /* Specify library files to be included in the compilation. */, | |
// "allowJs": true, /* Allow javascript files to be compiled. */ |