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.  
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 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    
isValid Accessor StaticReadOnly boolean true between a successful call to IModelHost.startup and before IModelHost.shutdown  
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  
profileDir Accessor StaticReadOnly string The full path of the Profile directory.  
profileName Accessor StaticReadOnly string The name of the Profile directory (a subdirectory of "IModelHost.cacheDir/profiles/") for this process.  
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.  
userMoniker Static string A string that can identify the current user to other users when collaborating.  

Defined in

Last Updated: 28 March, 2024