Could we make `if (callback && typeof callback === 'function') {req.onerror = callback}` ?