MCPcopy Create free account
hub / github.com/ajatkj/scriptable / getWeatherIcon

Function getWeatherIcon

LSWeather.js:446–459  ·  view source on GitHub ↗
(iconID, isNight)

Source from the content-addressed store, hash-verified

444FUNCTION getWeatherIcon
445------------------------------------------------------------------*/
446async function getWeatherIcon(iconID, isNight){
447 try {
448 const iconIDNight = iconID.replace("d","n");
449 if (isNight) iconID = iconIDNight;
450 const iconURL = baseWeatherIconURL + "/" + iconID + "@2x.png";
451 writeLOG(`Fetching url: ${iconURL}`);
452 let request = new Request(iconURL);
453 return await request.loadImage();
454 } catch (error) {
455 errMsg = "getWeatherIcon_" + error.message.replace(/\s/g,"_");
456 writeLOG(errMsg);
457 return;
458 }
459}
460/*------------------------------------------------------------------
461FUNCTION createOverlay
462------------------------------------------------------------------*/

Callers 1

createOverlayFunction · 0.85

Calls 1

writeLOGFunction · 0.70

Tested by

no test coverage detected