import { getTinyliciousContainer } from "@fluid-experimental/get-container" ; import { getDefaultObjectFromContainer } from "@fluidframework/aqueduct" ; import { Spaces } from "./fluid-object" ; import { SpacesContainer } from "./container" ; export { Spaces as SpacesExample , SpacesContainer } ; /**
 * This is a helper function for loading the page. It's required because getting the Fluid Container
 * requires making async calls.
 */ async function start ( ) { const shouldCreateNew = location . hash . length === 0 ; const documentId = ! shouldCreateNew ? window . location . hash . substring ( 1 ) : "" ; const [ container , containerId ] = await getTinyliciousContainer ( documentId , SpacesContainer , shouldCreateNew ) ; location . hash = containerId ; document . title = containerId ; const defaultObject = await getDefaultObjectFromContainer < Spaces > ( container ) ; const contentDiv = document . getElementById ( "content" ) ; if ( contentDiv !== null ) { defaultObject . render ( contentDiv ) ; } window [ "fluidStarted" ] = true ; } start ( ) . catch ( ( e ) => { console . error ( e ) ; console . log ( "%cEnsure you are running the Tinylicious Fluid Server\nUse:`npm run start:server`" , "font-size:30px" ) ; } ) ;