IModelHost Class

IModelHost initializes core-backend and captures its configuration. A backend must call IModelHost.startup before using any backend classes. See the learning article

Methods

Name Description
getAccessToken(): Promise<string> Static Get the current access token for this IModelHost, or a blank string if none is available.  
getHubAccess(): undefined | BackendHubAccess Static get the current hubAccess, if present. Beta  
shutdown(): Promise<void> Static This method must be called when an iTwin.js host is shut down.  
startup(options?: IModelHostOptions): Promise<void> Static This method must be called before any iTwin.js services are used.  

Properties

Name Type Description
appAssetsDir Accessor StaticReadOnly undefined | string The directory where application assets may be found  
applicationId Accessor Static string The Id of this application - needs to be set only if it is an agent application.  
applicationVersion Accessor Static string The version of this application - needs to be set if is an agent application.  
appWorkspace Accessor StaticReadOnly Workspace The application Workspace for this IModelHost  
authorizationClient Static undefined | AuthorizationClient The AuthorizationClient used to obtain AccessTokens.  
backendVersion Static string    
cacheDir Accessor StaticReadOnly string Root directory holding files that iTwin.js caches  
configuration Static undefined | IModelHostOptions    
hubAccess Accessor StaticReadOnly BackendHubAccess Provides access to the IModelHub for this IModelHost  
isValid Accessor StaticReadOnly boolean Returns true if IModelHost is started.  
logTileLoadTimeThreshold Accessor StaticReadOnly number The backend will log when a tile took longer to load than this threshold in seconds.  
logTileSizeThreshold Accessor StaticReadOnly number The backend will log when a tile is loaded with a size in bytes above this threshold.  
onAfterStartup StaticReadonly BeEvent<() => void> Event raised just after the backend IModelHost was started  
onBeforeShutdown StaticReadonly BeEvent<() => void> Event raised just before the backend IModelHost is to be shut down  
onWorkspaceStartup StaticReadonly BeEvent<() => void> Event raised during startup to allow loading settings data  
sessionId Accessor Static string A uniqueId for this session  
snapshotFileNameResolver Static undefined | FileNameResolver The optional FileNameResolver that resolves keys and partial file names for snapshot iModels.  

Defined in

Last Updated: 20 June, 2023