IModelHost Class

IModelHost initializes core-backend and captures its configuration. A backend must call 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.  
shutdown(this: void): 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 Static ReadOnly 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 Static ReadOnly Workspace The application Workspace for this IModelHost  
authorizationClient Static AuthorizationClient | undefined The AuthorizationClient used to obtain AccessTokens.  
backendVersion Static string    
cacheDir Accessor Static ReadOnly string Root directory holding files that iTwin.js caches  
configuration Static IModelHostOptions | undefined    
isValid Accessor Static ReadOnly boolean true between a successful call to startup and before shutdown  
logTileLoadTimeThreshold Accessor Static ReadOnly number The backend will log when a tile took longer to load than this threshold in seconds.  
logTileSizeThreshold Accessor Static ReadOnly number The backend will log when a tile is loaded with a size in bytes above this threshold.  
onAfterStartup Static Readonly BeEvent<() => void> Event raised just after the backend IModelHost was started  
onBeforeShutdown Static Readonly BeEvent<() => void> Event raised just before the backend IModelHost is to be shut down  
onWorkspaceStartup Static Readonly BeEvent<() => void> Event raised during startup to allow loading settings data  
profileDir Accessor Static ReadOnly string The full path of the Profile directory.  
profileName Accessor Static ReadOnly string The name of the Profile directory (a subdirectory of "cacheDir/profiles/") for this process.  
sessionId Accessor Static string A uniqueId for this session  
settingsSchemas Accessor Static ReadOnly SettingsSchemas The registry of schemas describing the Settings for the application session.  
snapshotFileNameResolver Static FileNameResolver | undefined The optional FileNameResolver that resolves keys and partial file names for snapshot iModels. Deprecated  
userMoniker Static string A string that can identify the current user to other users when collaborating.  

Defined in

Last Updated: 13 November, 2024