2
0
mirror of synced 2025-02-24 20:18:07 +00:00

Fixed utils.poll from mutating passed variables.

This commit is contained in:
Richard Moore 2018-10-14 19:01:09 -04:00
parent 023a20ff47
commit f682861e0b
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

View File

@ -3,6 +3,7 @@
import { XMLHttpRequest } from 'xmlhttprequest';
import { encode as base64Encode } from './base64';
import { shallowCopy } from './properties';
import { toUtf8Bytes } from './utf8';
import * as errors from '../errors';
@ -180,6 +181,7 @@ export function fetchJson(connection: string | ConnectionInfo, json: string, pro
export function poll(func: () => Promise<any>, options?: PollOptions): Promise<any> {
if (!options) { options = {}; }
options = shallowCopy(options);
if (options.floor == null) { options.floor = 0; }
if (options.ceiling == null) { options.ceiling = 10000; }
if (options.interval == null) { options.interval = 250; }