fetch

Convenience HTTP fetch returning response text.

fetch(url)fetch(url, params)

Example

// 
// ScriptWidget 
// https://xnu.app/scriptwidget
// 
// Usage for api $fetch
// 

// query json example
// https://jsonplaceholder.typicode.com/

const url = "https://jsonplaceholder.typicode.com/todos/1";
const result = await fetch(url);
console.log(result);

const model = JSON.parse(result);

$render(
  <vstack>
    <text font="title">receive title: {model.title}</text>
  </vstack>
);
HealthKit and Location data are only available after user authorization in the main app. Widgets may show cached or fallback data.