Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate

Issue 12834005: Fixing documentation for HttpRequest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 /** 7 /**
8 * A utility for retrieving data from a URL. 8 * A utility for retrieving data from a URL.
9 * 9 *
10 * HttpRequest can be used to obtain data from http, ftp, and file 10 * HttpRequest can be used to obtain data from http, ftp, and file
11 * protocols. 11 * protocols.
12 * 12 *
13 * For example, suppose we're developing these API docs, and we 13 * For example, suppose we're developing these API docs, and we
14 * wish to retrieve the HTML of the top-level page and print it out. 14 * wish to retrieve the HTML of the top-level page and print it out.
15 * The easiest way to do that would be: 15 * The easiest way to do that would be:
16 * 16 *
17 * var httpRequest = HttpRequest.get('http://api.dartlang.org', 17 * HttpRequest.getString('http://api.dartlang.org').then((response) {
18 * (request) => print(request.responseText)); 18 * print(response);
19 * });
19 * 20 *
20 * **Important**: With the default behavior of this class, your 21 * **Important**: With the default behavior of this class, your
21 * code making the request should be served from the same origin (domain name, 22 * code making the request should be served from the same origin (domain name,
22 * port, and application layer protocol) as the URL you are trying to access 23 * port, and application layer protocol) as the URL you are trying to access
23 * with HttpRequest. However, there are ways to 24 * with HttpRequest. However, there are ways to
24 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp). 25 * [get around this restriction](http://www.dartlang.org/articles/json-web-servi ce/#note-on-jsonp).
25 * 26 *
26 * See also: 27 * See also:
27 * 28 *
28 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data) 29 * * [Dart article on using HttpRequests](http://www.dartlang.org/articles/json- web-service/#getting-data)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 $if DART2JS 142 $if DART2JS
142 var xhr = new HttpRequest(); 143 var xhr = new HttpRequest();
143 return JS('bool', '"onloadend" in #', xhr); 144 return JS('bool', '"onloadend" in #', xhr);
144 $else 145 $else
145 return true; 146 return true;
146 $endif 147 $endif
147 } 148 }
148 149
149 $!MEMBERS 150 $!MEMBERS
150 } 151 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698