Widget Request Interceptors
Live provides an API where plugins can intercept and alter any widget request before it reaches the backend.
The Widget Request Interceptor API
How to use
// plugin-number-precision/src/webapp/main.ts
import { LiveApi } from 'live/lib/api'
// This function will be called before every widget request is made.
function includePrecision(widgetRequest, dashboardParams) {
// Don't change anything on edit mode
if (dashboardParams?.mode === 'edit' ) {
return widgetRequest
}
// Add custom parameter
widgetRequest.userConfig.precisionLevel = 'HIGH'
return widgetRequest
}
LiveApi.Interceptor.widget.requests.register(includePrecision)Last updated