import { IContainerContext , IRuntime , IRuntimeFactory , } from "@fluidframework/container-definitions" ; import { IContainerRuntime } from "@fluidframework/container-runtime-definitions" ; export abstract class RuntimeFactoryHelper < T = IContainerRuntime > implements IRuntimeFactory { public get IRuntimeFactory ( ) { return this ; } public async instantiateRuntime ( context , existing ? ) { const fromExisting = existing === undefined ? context . existing === true : existing ; const runtime = await this . preInitialize ( context , fromExisting ) ; if ( fromExisting ) { await this . instantiateFromExisting ( runtime ) ; } else { await this . instantiateFirstTime ( runtime ) ; } await this . hasInitialized ( runtime ) ; return runtime ; } public abstract preInitialize ( context , existing ) ; public async instantiateFirstTime ( _runtime ) { } public async instantiateFromExisting ( _runtime ) { } public async hasInitialized ( _runtime ) { } }