OLD | NEW |
1 library html; | 1 library html; |
2 | 2 |
3 import 'dart:async'; | 3 import 'dart:async'; |
4 import 'dart:collection'; | 4 import 'dart:collection'; |
5 import 'dart:html_common'; | 5 import 'dart:html_common'; |
6 import 'dart:indexed_db'; | 6 import 'dart:indexed_db'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 import 'dart:json' as json; | 8 import 'dart:json' as json; |
9 import 'dart:math'; | 9 import 'dart:math'; |
10 import 'dart:svg' as svg; | 10 import 'dart:svg' as svg; |
(...skipping 25640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25651 }; | 25651 }; |
25652 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 25652 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
25653 // for details. All rights reserved. Use of this source code is governed by a | 25653 // for details. All rights reserved. Use of this source code is governed by a |
25654 // BSD-style license that can be found in the LICENSE file. | 25654 // BSD-style license that can be found in the LICENSE file. |
25655 | 25655 |
25656 | 25656 |
25657 class _HttpRequestUtils { | 25657 class _HttpRequestUtils { |
25658 | 25658 |
25659 // Helper for factory HttpRequest.get | 25659 // Helper for factory HttpRequest.get |
25660 static HttpRequest get(String url, | 25660 static HttpRequest get(String url, |
25661 onSuccess(HttpRequest request), | 25661 onComplete(HttpRequest request), |
25662 bool withCredentials) { | 25662 bool withCredentials) { |
25663 final request = new HttpRequest(); | 25663 final request = new HttpRequest(); |
25664 request.open('GET', url, true); | 25664 request.open('GET', url, true); |
25665 | 25665 |
25666 request.withCredentials = withCredentials; | 25666 request.withCredentials = withCredentials; |
25667 | 25667 |
25668 // Status 0 is for local XHR request. | |
25669 request.on.readyStateChange.add((e) { | 25668 request.on.readyStateChange.add((e) { |
25670 if (request.readyState == HttpRequest.DONE && | 25669 if (request.readyState == HttpRequest.DONE) { |
25671 (request.status == 200 || request.status == 0)) { | 25670 onComplete(request); |
25672 onSuccess(request); | |
25673 } | 25671 } |
25674 }); | 25672 }); |
25675 | 25673 |
25676 request.send(); | 25674 request.send(); |
25677 | 25675 |
25678 return request; | 25676 return request; |
25679 } | 25677 } |
25680 } | 25678 } |
25681 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 25679 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
25682 // for details. All rights reserved. Use of this source code is governed by a | 25680 // for details. All rights reserved. Use of this source code is governed by a |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
26970 _position = nextPosition; | 26968 _position = nextPosition; |
26971 return true; | 26969 return true; |
26972 } | 26970 } |
26973 _current = null; | 26971 _current = null; |
26974 _position = _array.length; | 26972 _position = _array.length; |
26975 return false; | 26973 return false; |
26976 } | 26974 } |
26977 | 26975 |
26978 T get current => _current; | 26976 T get current => _current; |
26979 } | 26977 } |
OLD | NEW |