Update to Prettier 2 and use ES Private Fields (#4498)

This commit is contained in:
Kitson Kelly 2020-03-29 04:03:49 +11:00 committed by GitHub
parent 1397b8e0e7
commit bced52505f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
329 changed files with 2787 additions and 2430 deletions

View file

@ -14,17 +14,21 @@ interface PluginOp {
}
class PluginOpImpl implements PluginOp {
constructor(private readonly opId: number) {}
readonly #opId: number;
constructor(opId: number) {
this.#opId = opId;
}
dispatch(
control: Uint8Array,
zeroCopy?: ArrayBufferView | null
): Uint8Array | null {
return core.dispatch(this.opId, control, zeroCopy);
return core.dispatch(this.#opId, control, zeroCopy);
}
setAsyncHandler(handler: AsyncHandler): void {
core.setAsyncHandler(this.opId, handler);
core.setAsyncHandler(this.#opId, handler);
}
}
@ -37,16 +41,16 @@ interface Plugin {
}
class PluginImpl implements Plugin {
private _ops: { [name: string]: PluginOp } = {};
#ops: { [name: string]: PluginOp } = {};
constructor(private readonly rid: number, ops: { [name: string]: number }) {
constructor(_rid: number, ops: { [name: string]: number }) {
for (const op in ops) {
this._ops[op] = new PluginOpImpl(ops[op]);
this.#ops[op] = new PluginOpImpl(ops[op]);
}
}
get ops(): { [name: string]: PluginOp } {
return Object.assign({}, this._ops);
return Object.assign({}, this.#ops);
}
}