*/
formatSeconds: function formatSeconds(seconds) {
function pad(n, val) ("0000000" + val).substr(-Math.max(n, String(val).length));
- function div(num, denom) [Math.round(num / denom), Math.round(num % denom)];
+ function div(num, denom) [Math.floor(num / denom), Math.round(num % denom)];
let days, hours, minutes;
- [minutes, seconds] = div(seconds, 60);
+ [minutes, seconds] = div(Math.round(seconds), 60);
[hours, minutes] = div(minutes, 60);
[days, hours] = div(hours, 24);
if (days)
* responseType: {string} Override the type of the "response"
* property.
*
+ * headers: {objects} Extra request headers.
+ *
* user: {string} The user name to send via HTTP Authentication.
* pass: {string} The password to send via HTTP Authentication.
*
params.data = data;
}
-
if (params.mimeType)
xmlhttp.overrideMimeType(params.mimeType);
- xmlhttp.open(params.method || "GET", url, async,
- params.user, params.pass);
+ let args = [params.method || "GET", url, async];
+ if (params.user != null || params.pass != null)
+ args.push(params.user);
+ if (params.pass != null)
+ args.push(prams.pass);
+ xmlhttp.open.apply(xmlhttp, args);
+
+ for (let [header, val] in Iterator(params.headers || {}))
+ xmlhttp.setRequestHeader(header, val);
if (params.responseType)
xmlhttp.responseType = params.responseType;
* Escapes a string against shell meta-characters and argument
* separators.
*/
- shellEscape: function shellEscape(str) '"' + String.replace(str, /[\\"$]/g, "\\$&") + '"',
+ shellEscape: function shellEscape(str) '"' + String.replace(str, /[\\"$`]/g, "\\$&") + '"',
/**
* Suspend execution for at least *delay* milliseconds. Functions by