mirror of
https://github.com/coder/code-server.git
synced 2026-05-12 15:27:25 +02:00
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:
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user