Skip to content

Instantly share code, notes, and snippets.

@gadflying
gadflying / FocusManager.jsx
Created August 19, 2019 23:09 — forked from forgo/FocusManager.jsx
Handle composite focus and blur events in React.
import React from 'react'
import ReactDOM from 'react-dom'
import { Key } from '../utils/keyboardUtils'
export default class FocusManager extends React.Component {
constructor(props) {
super(props)
this._immediateID = null
this.state = {
// pattern 1
await Promise.all(
files.map(async file => {
let fileSize = await getSize(file);
totalSize += fileSize;
})
);
// =======================================================
// Poller.js
// =======================================================
const EventEmitter = require('events');
class Poller extends EventEmitter {
/**
* @param {int} timeout how long should we wait after the poll started?
*/
constructor(timeout = 100) {