If you ever need to delay a promise (for debugging purposes and whatnot), use the following:

function delay(ms) {
    return (data) => new Promise(resolve => { setTimeout(() => resolve(data), ms); });
}