Merge pull request #6839 from arusakov/whatwg-fetch-global-variable

Whatwg fetch global fetch variable
This commit is contained in:
Masahiro Wakame
2015-11-20 00:53:33 +09:00
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -39,6 +39,13 @@ function test_fetchUrlWithRequestObject() {
handlePromise(window.fetch(request));
}
function test_globalFetchVar() {
fetch('http://test.com', {})
.then(response => {
// for test only
});
}
function handlePromise(promise: Promise<Response>) {
promise.then((response) => {
if (response.type === 'basic') {
+2
View File
@@ -83,3 +83,5 @@ declare type RequestInfo = Request|string;
interface Window {
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
}
declare var fetch: typeof window.fetch;