fetch global variable

This commit is contained in:
Alexander Rusakov 2015-11-19 16:10:13 +03:00
parent fc341765eb
commit c865ee8d59
2 changed files with 9 additions and 0 deletions

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') {

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;