@itwin/presentation-shared
Version:
The package contains types and utilities used across different iTwin.js Presentation packages.
55 lines • 1.97 kB
TypeScript
/**
* An utility to parse schema and class names from full class name, where
* schema and class names are separated by either `:` or `.`.
* @public
*/
export declare function parseFullClassName(fullClassName: string): {
schemaName: string;
className: string;
};
/**
* An utility to normalize full class name from either `SchemaName:ClassName` or
* `SchemaName.ClassName` to always use the dot format.
* @public
*/
export declare function normalizeFullClassName(fullClassName: string): string;
/**
* An utility to remove all extra whitespace from a given string.
* @public
*/
export declare function trimWhitespace(str: string): string;
/**
* An utility to remove all extra whitespace from a given string.
* @public
*/
export declare function trimWhitespace(str: string | undefined): string | undefined;
/**
* An utility that returns a promise that immediately resolves. Awaiting on the returned
* promise releases the main thread and allows other tasks to run.
*
* @public
*/
export declare function releaseMainThread(): Promise<void>;
/**
* An utility that returns a `releaseMainThread` promise if the given amount of time has passed since the handler
* was created or the main thread was last released using this handler. Otherwise, returns `undefined`.
*
* Example:
* ```ts
* const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();
* for (const value of someVeryLargeArray) {
* await releaseMainThread();
* // do something with value
* }
* ```
*
* @param releaseOnTimePassed The amount of time in milliseconds after which the main thread should be released. Defaults to `40` ms.
* @public
*/
export declare function createMainThreadReleaseOnTimePassedHandler(releaseOnTimePassed?: number): () => Promise<void> | undefined;
/**
* An utility to convert a julian day format to `Date`.
* @public
*/
export declare function julianToDateTime(julianDate: number): Date;
//# sourceMappingURL=Utils.d.ts.map