import { FluidObject } from "@fluidframework/core-interfaces" ; import { Container , Loader } from "@fluidframework/container-loader" ; import { launchCLI } from "./cli" ; /**
 * fetchCore is used to make a request against the loader to load a Fluid object.
 */ async function fetchCore ( loader , url ) { const response = await loader . request ( { url } ) ; if ( response . status !== 200 || response . mimeType !== "fluid/object" ) { return ; } const fluidObject = response . value ; launchCLI ( fluidObject ) ; } /**
 * fetchFluidObject is used to allow a host to interact with a Fluid object. Given that we may be establishing a
 * new set of code on the document it listens for the "contextChanged" event which fires when a new code value is
 * quorumed on.
 */ export async function fetchFluidObject ( loader , container , url ) { await fetchCore ( loader , url ) ; container . on ( "contextChanged" , ( ) => { fetchCore ( loader , url ) ; } ) ; }