on start method for start opts

This commit is contained in:
nick-delirium 2024-10-08 13:56:49 +02:00
parent c76aed39f7
commit 6894da56da
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0

View file

@ -52,6 +52,12 @@ export interface StartOptions {
forceNew?: boolean
sessionHash?: string
assistOnly?: boolean
/**
* @deprecated We strongly advise to use .start().then instead.
*
* This method is kept for snippet compatibility only
* */
startCallback?: (result: StartPromiseReturn) => void
}
interface OnStartInfo {
@ -1399,6 +1405,9 @@ export default class App {
// TODO: start as early as possible (before receiving the token)
/** after start */
this.startCallbacks.forEach((cb) => cb(onStartInfo)) // MBTODO: callbacks after DOM "mounted" (observed)
if (startOpts.startCallback) {
startOpts.startCallback(onStartInfo)
}
if (this.features['feature-flags']) {
void this.featureFlags.reloadFlags()
}