Skip to content

Commit

Permalink
The Fetch API adds the "fetch" global.
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw committed May 2, 2015
1 parent 2b673d9 commit c6c0635
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/vars.js
Expand Up @@ -83,6 +83,7 @@ exports.browser = {
ElementTimeControl : false,
Event : false,
event : false,
fetch : false,
FileReader : false,
FormData : false,
focus : false,
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/fixtures/browser.js
Expand Up @@ -25,3 +25,13 @@ var comment = new Comment("");
var df = new DocumentFragment();
var range = new Range();
var text = new Text("");

// Fetch example
// comes from MDN https://developer.mozilla.org/en-US/docs/Web/API/GlobalFetch
var myImage = document.querySelector('.my-image');
fetch('flowers.jpg').then(function(response) {
return response.blob();
}).then(function(response) {
var objectURL = URL.createObjectURL(response);
myImage.src = objectURL;
});
3 changes: 3 additions & 0 deletions tests/unit/options.js
Expand Up @@ -1509,6 +1509,9 @@ exports.browser = function (test) {
.addError(25, "'DocumentFragment' is not defined.")
.addError(26, "'Range' is not defined.")
.addError(27, "'Text' is not defined.")
.addError(31, "'document' is not defined.")
.addError(32, "'fetch' is not defined.")
.addError(35, "'URL' is not defined.")
.test(src, {es3: true, undef: true });

TestRun(test).test(src, {es3: true, browser: true, undef: true });
Expand Down

0 comments on commit c6c0635

Please sign in to comment.