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

@@ -1,11 +1,11 @@
import { IDisposable } from "@coder/disposable";
import { Emitter } from "@coder/events";
/**
* Wrapper around the native clipboard with some fallbacks.
*/
export class Clipboard {
private readonly enableEmitter: Emitter<boolean> = new Emitter();
private readonly enableEmitter = new Emitter<boolean>();
public readonly onPermissionChange = this.enableEmitter.event;
private _isEnabled: boolean = false;
/**
@@ -70,14 +70,6 @@ export class Clipboard {
// tslint:enable no-any
}
/**
* Register a function to be called when the native clipboard is
* enabled/disabled.
*/
public onPermissionChange(cb: (enabled: boolean) => void): IDisposable {
return this.enableEmitter.event(cb);
}
/**
* Read text from the clipboard.
*/