Just noticed that XMLHttpRequest is ignoring the timeout property on Fuse, I’m running version 1.0.1 (build 13566) on Windows 10 here.
I prepared this test case to make a request to some url, all event handlers work as expected, but the ontimeout.
<App>
<JavaScript>
var Observable = require("FuseJS/Observable");
var latency = Observable(0);
var url = Observable("https://www.fusetools.com");
var xhr;
function abort() {
if(xhr != null) xhr.abort();
};
function submit() {
refTime = new Date().getTime();
xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
console.log("readyState: "+xhr.readyState);
console.log("status: "+ xhr.status);
console.log("statusText: "+ xhr.statusText);
console.log("responseType: "+ xhr.responseType);
}
xhr.onload = function () {
debug_log("Loaded!");
latency.value = (new Date().getTime()) - refTime;
};
xhr.onerror = function(err) {
debug_log("Error!");
debug_log(JSON.stringify(err));
};
xhr.onabort = function () {
debug_log("Request aborted!");
};
xhr.onloadstart = function () {
debug_log("Request started!");
};
xhr.ontimeout = function () {
debug_log("Timeout!");
latency.value = (new Date().getTime()) - refTime;
}
xhr.open('GET',encodeURI(url.value));
xhr.timeout = 20;
xhr.send();
}
module.exports = {
submit:submit,
latency:latency,
url:url,
abort:abort
}
</JavaScript>
<StackPanel Alignment="Center" Width="90%" ContentAlignment="Left" ItemSpacing="20">
<TextBox Value="{url}" ActionTriggered="{submit}"/>
<Button Alignment="Left" Text="Send Request" Clicked="{submit}"/>
<Button Alignment="Left" Text="Abort" Clicked="{abort}"/>
<Text Value="Latency: {latency} milliseconds"/>
</StackPanel>
</App>