FB3ReaderSite.ILoadProgress - Litres/FB3Reader GitHub Wiki

Definition

interface ILoadProgress {
	HourglassOn(Owner: any, LockUI?: boolean, Message?: string): void;
	Progress(Owner: any, Progress: number): void;
	HourglassOff(Owner: any): void;
	Tick(Owner: any): void;
	Alert: IAlert;
}

Overall info

This is the way for internal reader mechanics to work with "hourglass", "progress" ans other such stuff. Say, when the reader engine wants to turn the page and finds that required data is still not loaded, it will try to asyncroneosly load it and will call the provided ILoadProgress instance for HourglassOn to inform a user some delay is under way. While data is loading some Progress or Tick may happend, then will be time for HourglassOff. In case the loading had failed the Alert will be called.

Consumer must implement this interface and provide it to other classes. You can see ExampleProgressor class to see how it should work.

Methods

HourglassOn (Owner: any, LockUI?: boolean, Message?: string): void;
Fired when the reader's member expects (for any reason) the operation to take long. If LockUI is true GUI must freeze and show some feedback to the user about the fact that current operation will take some time and the program is not going to respond. If LockUI is false application should show some "In progress" informer.
Owner - caller instance. As long as internal mechanics of the reader is asynchronous several classes may call HourglassOn and HourglassOff several times. Class should handle that case and remember who have called on and off and really hide hourglass only when ALL callers have ordered to Off (see HourglassOff below).
LockUI - optional, defines whether or not should interface of the app be locked. For background preloading of data this will be false, while if user action is delayed this will be true. For example, it's true during initial metadata loading. Defaults to false
Message - optional plain-text message about the kind of time-consuming activity application is going to perform.
HourglassOff (Owner: any): void;
Fired when the reader's member has finished time-consuming operations and (it is believed) it is ready to interact in real-time
⚠️ **GitHub.com Fallback** ⚠️