Controller
createUpwell(), UpwellOptions, UpwellState and the UpwellController methods.
import { createUpwell, UpwellController, type UpwellOptions, type UpwellState } from 'upwell';The controller runs Upwell end to end. It reads the device, fetches the policy, asks the store and the
OTA tool, runs decide(), and performs the resulting update. It doesn't depend on React;
UpwellProvider wraps it.
const upwell = createUpwell({ policy: 'https://cdn.example.com/upwell/policy.json' });UpwellOptions
Prop
Type
Methods
| Method | |
|---|---|
check(opts?) | Re-evaluates everything. Concurrent calls share one run. Without { force: true }, a check within minCheckIntervalMs of the last one returns the current decision |
startUpdate() | Does what the current decision calls for: the store flow, installing a downloaded update, or restarting into an OTA update |
startStoreUpdate(flow?) | Starts a store flow (default: the decision's flow). Falls back to the store link if a Play flow fails |
completeStoreUpdate() | Installs a downloaded flexible update. The app restarts |
applyOta() | Restarts into the downloaded OTA update |
dismiss() | "Later" for the current decision |
markUpdateSeen() | Clears justUpdated |
explain() | { decision, trace } for the current decision |
handleAppStateChange(next) | Call with AppState changes when you don't use the provider. 'active' checks; 'background' installs a postponed flexible update |
simulate(scenario, options?) | Jumps to a simulated state. null returns to the real device |
getState() | The current UpwellState |
subscribe(listener) | Calls listener(state) on every change. Returns an unsubscribe function |
dispose() | Stops listening to the store and drops all listeners |
UpwellState
Prop
Type