PageSourceSearch

https://eco-freq-o.netlify.app/CarbonAPI.js

js eco-freq-o.netlify.app collected 2026-10-03 10:40:47 UTC 1,361 bytes, 47 lines download raw bytes

1////// GEOLOCATES USER > FINDS POSTCODE > RETURN LIVE CARBON EMISSIONS FOR THAT POSTCODE ///////
2/////// UNFORTUNATELY THE DATA RETRIEVED ISNT BEING USED,
3/////RAN OUT OF TIME TO FIND SOMETHING COOL TO DO WITH IT//////
4
5let long;
6let lat;
7let postcode;
8let carbonEmissionForecast;
9
10const getGeoLocation = () =>
11  new Promise((resolve, reject) =>
12    navigator.geolocation.getCurrentPosition(resolve, reject)
13  );
14
15const getPostCode = (longitude, latitude) => {
16  console.log(
17    `https://api.postcodes.io/postcodes/lon/${longitude}/lat/${latitude}`
18  );
19  return fetch(
20    `https://api.postcodes.io/postcodes/lon/${longitude}/lat/${latitude}`
21  );
22};
23
24const getRegionalData = (postcode) =>
25  fetch(`https://api.carbonintensity.org.uk/regional/postcode/${postcode}`);
26
27if ("geolocation" in navigator) {
28  getGeoLocation()
29    .then((x) => {
30      console.log({ x });
31      return x;
32    })
33    .then((x) => getPostCode(x.coords.longitude, x.coords.latitude))
34    .then((x) => x.json())
35    .then((x) => {
36      console.log({ x });
37      return x.result[0].postcode;
38    })
39    .then((postcode) => getRegionalData(postcode.split(" ")[0]))
40    .then((x) => x.json())
41    .then(
42      (x) => (carbonEmissionForecast = x.data[0].data[0].intensity.forecast)
43    )
44    .then((x) => console.log(carbonEmissionForecast));
45} else {
46  console.log("is not available");
47}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.