Some cleanup

- Use whateverEmitter.event for the onWhatever methods.
- Add readonly to a bunch of things.
- Remove some redundancy in types.
- Move initializations out of the constructor and into the declarations
  where it was reasonable to do so.
- Disable a few no-any violations.
This commit is contained in:
Asher
2019-02-06 11:53:23 -06:00
parent ddf96077a3
commit 588da0443c
16 changed files with 98 additions and 164 deletions

View File

@@ -21,7 +21,7 @@ interface IRetryItem {
* to the user explaining what is happening with an option to immediately retry.
*/
export class Retry {
private items: Map<string, IRetryItem>;
private items = new Map<string, IRetryItem>();
// Times are in seconds.
private readonly retryMinDelay = 1;
@@ -31,17 +31,15 @@ export class Retry {
private blocked: string | boolean | undefined;
private notificationHandle: INotificationHandle | undefined;
private updateDelay = 1;
private readonly updateDelay = 1;
private updateTimeout: number | NodeJS.Timer | undefined;
private notificationThreshold = 3;
private readonly notificationThreshold = 3;
// Time in milliseconds to wait before restarting a service. (See usage below
// for reasoning.)
private waitDelay = 50;
private readonly waitDelay = 50;
public constructor(private _notificationService: INotificationService) {
this.items = new Map();
}
public constructor(private _notificationService: INotificationService) {}
public set notificationService(service: INotificationService) {
this._notificationService = service;