@@ -14,6 +14,7 @@ import { DefaultReconnectionHandler } from './Platform/Circuits/DefaultReconnect
1414import { attachRootComponentToLogicalElement } from './Rendering/Renderer' ;
1515import { discoverComponents , discoverPersistedState , ServerComponentDescriptor } from './Services/ComponentDescriptorDiscovery' ;
1616import { sendJSDataStream } from './Platform/Circuits/CircuitStreamingInterop' ;
17+ import { JSInitializers } from './JSInitializers' ;
1718
1819let renderingFailed = false ;
1920let started = false ;
@@ -26,6 +27,15 @@ async function boot(userOptions?: Partial<CircuitStartOptions>): Promise<void> {
2627
2728 // Establish options to be used
2829 const options = resolveOptions ( userOptions ) ;
30+ const jsInitializersResponse = await fetch ( '_blazor/initializers' , {
31+ method : 'GET' ,
32+ credentials : 'include' ,
33+ cache : 'no-cache'
34+ } ) ;
35+
36+ const initializers : string [ ] = await jsInitializersResponse . json ( ) ;
37+ const afterStartedCallbacks = await JSInitializers . invokeInitializersAsync ( initializers , [ options ] ) ;
38+
2939 const logger = new ConsoleLogger ( options . logLevel ) ;
3040 Blazor . defaultReconnectionHandler = new DefaultReconnectionHandler ( logger ) ;
3141
@@ -36,7 +46,6 @@ async function boot(userOptions?: Partial<CircuitStartOptions>): Promise<void> {
3646 const appState = discoverPersistedState ( document ) ;
3747 const circuit = new CircuitDescriptor ( components , appState || '' ) ;
3848
39-
4049 const initialConnection = await initializeConnection ( options , logger , circuit ) ;
4150 const circuitStarted = await circuit . startCircuit ( initialConnection ) ;
4251 if ( ! circuitStarted ) {
@@ -58,6 +67,8 @@ async function boot(userOptions?: Partial<CircuitStartOptions>): Promise<void> {
5867
5968 options . reconnectionHandler ! . onConnectionUp ( ) ;
6069
70+ Promise . all ( afterStartedCallbacks . map ( c => c ( Blazor ) ) ) ;
71+
6172 return true ;
6273 } ;
6374
0 commit comments