Skip to content

Highlight calls to "fetch" API #688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mixedCase opened this issue Oct 26, 2016 · 4 comments
Closed

Highlight calls to "fetch" API #688

mixedCase opened this issue Oct 26, 2016 · 4 comments

Comments

@mixedCase
Copy link
Contributor

https://fetch.spec.whatwg.org/

Fetch is the promise-based XMLHttpRequest replacement. It's globally available such as other currently highlighted objects like console and window.

Example code taken from the MDN:

fetch('flowers.jpg').then(function(response) {
  if(response.ok) {
    response.blob().then(function(myBlob) {
      var objectURL = URL.createObjectURL(myBlob);
      myImage.src = objectURL;
    });
  } else {
    console.log('Network response was not ok.');
  }
})
.catch(function(error) {
  console.log('There has been a problem with your fetch operation: ' + error.message);
});
@bounceme
Copy link
Collaborator

There are tons of other web apis. should we just add whichever ones people ask for? yajs uses a webidl system for this, but the keywords pollute other things like user defined prop names

@mixedCase
Copy link
Contributor Author

Good enough for GitHub and VSCode from what I've paid attention to today.

@bounceme
Copy link
Collaborator

we don't highlight any bultin method calls, but highlighting fetch seems alright

@bounceme
Copy link
Collaborator

https://developer.mozilla.org/en-US/docs/Web/API

any one keen to make the p.r. ?

mixedCase pushed a commit to mixedCase/vim-javascript that referenced this issue Oct 29, 2016
mixedCase pushed a commit to mixedCase/vim-javascript that referenced this issue Oct 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants