MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/Scriptable/comments/124yzxs/can_you_not_have_2_scriptable_widgets_code_and/jfov0me/
r/Scriptable • u/__Loot__ • Mar 28 '23
25 comments sorted by
View all comments
Show parent comment
1
Thanks for the help but i tried this.
async function master() { const API_KEY = '<key>'; async function fetchData(apiUrl) { const req = new Request(apiUrl); req.headers = { "Content-Type": "application/json" }; const json = await req.loadJSON(); return json; } const json = await fetchData(`https://api.nasa.gov/planetary/apod?api_key=${API_KEY}`); console.log(json); const title = json.title; const explanation = json.explanation; const image = json.hdurl; let widget = new ListWidget(); widget.backgroundColor = new Color('#222'); widget.addSpacer(20); const stack = widget.addStack(); stack.layoutVertically(); stack.addSpacer(20); const Title = stack.addText(title); Title.font = Font.boldSystemFont(15); // Fixed variable name (was 'title') Title.textColor = Color.white(); // Fixed function call (was 'Color.white') const req = new Request(image); const LoadImage = await req.loadImage(); const IMAGE = stack.addImage(LoadImage); IMAGE.imageSize = new Size(300, 300); IMAGE.cornerRadius = 15; IMAGE.centerAlignImage(); stack.addSpacer(10); widget.addSpacer(20); return widget } const widget = await master(); // Display the widget if (config.runsInWidget) { Script.setWidget(widget); Script.complete(); } else { await widget.presentLarge(); }
But the widget never loads?
1 u/[deleted] Apr 10 '23 edited Jun 12 '23 Alice; 'but when you throw them, and considered a little of the Lizard's slate-pencil, and the constant heavy sobbing of the. ― Jaunita Turner6B7A94FA-57D8-4D4D-8758-7715DD6E2CFC 1 u/__Loot__ Apr 10 '23 Cant find a non hd version 1 u/[deleted] Apr 10 '23 edited Jun 12 '23 The Mock Turtle replied in a very humble tone, going down on their slates, and she tried another question. 'What sort of thing. ― Selena Kuhlman7CFDC8CE-8D3B-4D83-8535-21AD511A76C5 1 u/__Loot__ Apr 10 '23 It works thanks man.
Alice; 'but when you throw them, and considered a little of the Lizard's slate-pencil, and the constant heavy sobbing of the. ― Jaunita Turner
6B7A94FA-57D8-4D4D-8758-7715DD6E2CFC
1 u/__Loot__ Apr 10 '23 Cant find a non hd version 1 u/[deleted] Apr 10 '23 edited Jun 12 '23 The Mock Turtle replied in a very humble tone, going down on their slates, and she tried another question. 'What sort of thing. ― Selena Kuhlman7CFDC8CE-8D3B-4D83-8535-21AD511A76C5 1 u/__Loot__ Apr 10 '23 It works thanks man.
Cant find a non hd version
1 u/[deleted] Apr 10 '23 edited Jun 12 '23 The Mock Turtle replied in a very humble tone, going down on their slates, and she tried another question. 'What sort of thing. ― Selena Kuhlman7CFDC8CE-8D3B-4D83-8535-21AD511A76C5
The Mock Turtle replied in a very humble tone, going down on their slates, and she tried another question. 'What sort of thing. ― Selena Kuhlman
7CFDC8CE-8D3B-4D83-8535-21AD511A76C5
It works thanks man.
View all comments
Show parent comment
1
u/__Loot__ Apr 10 '23 edited Apr 10 '23
Thanks for the help but i tried this.
But the widget never loads?