Foundation
script
Current script runtime context API.
script.context
script.context identifies the system host running the current JavaScript execution. Its type is ScriptContext.
| Value | Context |
|---|---|
"app" | Main OneScript app |
"widget" | Widget Extension |
"widgetConfig" | Configuration stage of the Widget Extension, see widget.provideOptions |
"action" | Share-sheet Action Extension |
Widget previews inside the main app use "app".
import { script } from "onescript"
if (script.context === "widget") {
console.log("Script is running in Widget Extension")
}How is this guide?
Last updated on