A configuration that any response can change
The configuration is a module of the page. Each response defines it again, and the module reads the new values when it is called.
// with the page
BigPipe::page()->define('AppConfig', [
'locale' => 'en',
'request' => ['timeout' => 8000, 'retries' => 2],
]);
// or with any response, replacing the module
return (new AsyncResponse())
->define('AppConfig', $newConfig)
->call('tutorial/ConfigReader', 'show', [
TransportMarker::element('config-output'),
])
->send();
// JavaScript
const { locale } = requireModule('AppConfig');