The global fetch() method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response is available.
fetch()
http:
https:
blob:
URL.createObjectURL()
data:
sdmc:
romfs:
file:
Optional
fetch('http://jsonip.com') .then(res => res.json()) .then(data => { console.log(`Current IP address: ${data.ip}`); }); Copy
fetch('http://jsonip.com') .then(res => res.json()) .then(data => { console.log(`Current IP address: ${data.ip}`); });
https://developer.mozilla.org/docs/Web/API/fetch
Generated using TypeDoc
The global
fetch()
method starts the process of fetching a resource from the network, returning a promise which is fulfilled once the response is available.Supported Protocols
http:
- Fetch data from the network using the HTTP protocolhttps:
- Fetch data from the network using the HTTPS protocolblob:
- Fetch data from a URL constructed byURL.createObjectURL()
data:
- Fetch data from a Data URI (possibly base64-encoded)sdmc:
- Fetch data from a local file on the SD cardromfs:
- Fetch data from the RomFS partition of the nx.js applicationfile:
- Same assdmc: