From 93f6199b984d4331d5cdf86c6b9a8cf3eedacb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=82=85=E9=B9=8F?= Date: Wed, 27 Jan 2021 22:20:07 +0800 Subject: [PATCH] fix: add timeout event --- src/request.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/request.ts b/src/request.ts index d41b38ea..864913b0 100644 --- a/src/request.ts +++ b/src/request.ts @@ -65,6 +65,10 @@ export default function upload(option: UploadRequestOption) { xhr.onerror = function error(e) { option.onError(e); }; + + xhr.ontimeout = function timeout(e) { + option.onError(e); + }; xhr.onload = function onload() { // allow success when 2xx status