UNPKG

@google/model-viewer

Version:

Easily display interactive 3D models on the web and in AR!

71 lines (70 loc) 3.22 kB
interface OngoingActivity { progress: number; } declare const $ongoingActivities: unique symbol; declare const $announceTotalProgress: unique symbol; declare const $eventDelegate: unique symbol; /** * An Activity is represented by a callback that accepts values from 0 to 1, * where 1 represents the completion of the activity. The callback returns the * actual progress as it is stored by the ProgressTracker (which may be clamped, * and can never be lower than its previous value). */ export declare type Activity = (progress: number) => number; /** * A progress event contains the total progress of all ongoing activities in the * ProgressTracker. The progress is a heuristic, should not be considered an * absolute representation of progress across any or all events. */ export interface ProgressDetails { totalProgress: number; } /** * ProgressTracker is an event emitter that helps to track the ongoing progress * of many simultaneous actions. * * ProgressTracker reports progress activity in the form of a progress event. * The event.detail.totalProgress value indicates the elapsed progress of all * activities being tracked by the ProgressTracker. * * The value of totalProgress is a number that progresses from 0 to 1. The * ProgressTracker allows for the lazy accumulation of tracked actions, so the * total progress represents a abstract, non-absolute progress towards the * completion of all currently tracked events. * * When all currently tracked activities are finished, the ProgressTracker * emits one final progress event and then resets the list of its currently * tracked activities. This means that from an observer's perspective, * ongoing activities will accumulate and collectively contribute to the notion * of total progress until all currently tracked ongoing activities have * completed. */ export declare class ProgressTracker implements EventTarget { protected [$eventDelegate]: DocumentFragment; addEventListener: typeof EventTarget.prototype.addEventListener; removeEventListener: typeof EventTarget.prototype.removeEventListener; dispatchEvent: typeof EventTarget.prototype.dispatchEvent; protected [$ongoingActivities]: Set<OngoingActivity>; /** * The total number of activities currently being tracked. */ get ongoingActivityCount(): number; /** * Registers a new activity to be tracked by the progress tracker. The method * returns a special callback that should be invoked whenever new progress is * ready to be reported. The progress should be reported as a value between 0 * and 1, where 0 would represent the beginning of the action and 1 would * represent its completion. * * There is no built-in notion of a time-out for ongoing activities, so once * an ongoing activity is begun, it is up to the consumer of this API to * update the progress until that activity is no longer ongoing. * * Progress is only allowed to move forward for any given activity. If a lower * progress is reported than the previously reported progress, it will be * ignored. */ beginActivity(): Activity; [$announceTotalProgress](): void; } export {};