Usage ES2020

ES2020 syntax showcase for ScriptWidget scripts.

Example


//
// ScriptWidget
// https://xnu.app/scriptwidget
//
//



const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string"

const baz = 0 ?? 42;
console.log(baz);
// expected output: 0

const someArray = [0, 1, 2, 3];
console.log(someArray);

const thisWillError = someArray[5];
console.log(thisWillError);

const thisWillBeUndefined = someArray?.[5];
console.log(thisWillBeUndefined);

$render(
  <vstack frame="max">
    <text font="title">Hello ES2020</text>
  </vstack>
);
HealthKit and Location data are only available after user authorization in the main app. Widgets may show cached or fallback data.