Skip to content

Commit

Permalink
refactor xhr.ontimeout & optimize the code (#2233)
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghui1998hhh authored Jun 4, 2024
1 parent a2850fe commit 0e3c9fc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions plugins/web_adapter/lib/src/js_interop/adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ export '../html/adapter.dart';
// import 'package:meta/meta.dart';
// import 'package:web/web.dart' as web;
//
// const progressEventProvider =
// web.EventStreamProvider<web.ProgressEvent>('progress');
//
// BrowserHttpClientAdapter createAdapter() => BrowserHttpClientAdapter();
//
// /// The default [HttpClientAdapter] for Web platforms.
Expand Down Expand Up @@ -113,7 +110,7 @@ export '../html/adapter.dart';
// // so we can check it beforehand.
// if (requestStream != null) {
// final xhrUploadProgressStream =
// progressEventProvider.forTarget(xhr.upload);
// web.EventStreamProviders.progressEvent.forTarget(xhr.upload);
//
// if (connectTimeoutTimer != null) {
// xhrUploadProgressStream.listen((_) {
Expand Down Expand Up @@ -145,7 +142,7 @@ export '../html/adapter.dart';
//
// final onSendProgress = options.onSendProgress;
// if (onSendProgress != null) {
// xhrUploadProgressStream.listen((web.ProgressEvent event) {
// xhrUploadProgressStream.listen((event) {
// onSendProgress(event.loaded, event.total);
// });
// }
Expand Down Expand Up @@ -198,7 +195,7 @@ export '../html/adapter.dart';
// }
//
// xhr.onProgress.listen(
// (web.ProgressEvent event) {
// (event) {
// if (connectTimeoutTimer != null) {
// connectTimeoutTimer!.cancel();
// connectTimeoutTimer = null;
Expand Down Expand Up @@ -226,7 +223,7 @@ export '../html/adapter.dart';
// );
// });
//
// xhr.ontimeout = (web.ProgressEvent event) {
// web.EventStreamProviders.timeoutEvent.forTarget(xhr).first.then((_) {
// final isConnectTimeout = connectTimeoutTimer != null;
// if (connectTimeoutTimer != null) {
// connectTimeoutTimer?.cancel();
Expand All @@ -249,7 +246,7 @@ export '../html/adapter.dart';
// );
// }
// }
// }.toJS;
// });
//
// cancelFuture?.then((_) {
// if (xhr.readyState < web.XMLHttpRequest.DONE &&
Expand Down

0 comments on commit 0e3c9fc

Please sign in to comment.