chore: add max-params eslint rule

This commit is contained in:
Simon Chan 2024-06-23 05:31:04 +08:00
parent 3c2b57cfc5
commit 73a0af4613
No known key found for this signature in database
GPG key ID: A8B69F750B9BCEDD
17 changed files with 79 additions and 54 deletions

View file

@ -70,17 +70,23 @@ export class WebCodecsVideoDecoder implements ScrcpyVideoDecoder {
* Enable this option may reduce performance.
* @param canvas Optional render target cavas element or offscreen canvas
*/
constructor(codec: ScrcpyVideoCodecId, enableCapture: boolean, canvas?: HTMLCanvasElement | OffscreenCanvas) {
constructor(
codec: ScrcpyVideoCodecId,
enableCapture: boolean,
canvas?: HTMLCanvasElement | OffscreenCanvas,
) {
this.#codec = codec;
if (canvas) {
this.#canvas = canvas
} else if (typeof document !== 'undefined') {
this.#canvas = canvas;
} else if (typeof document !== "undefined") {
this.#canvas = document.createElement("canvas");
} else if (typeof OffscreenCanvas !== 'undefined') {
} else if (typeof OffscreenCanvas !== "undefined") {
this.#canvas = new OffscreenCanvas(0, 0);
} else {
throw new Error('no canvas input found nor any canvas can be created');
throw new Error(
"no canvas input found nor any canvas can be created",
);
}
try {

View file

@ -33,7 +33,10 @@ export class WebGLFrameRenderer implements FrameRenderer {
* Whether to allow capturing the canvas content using APIs like `readPixels` and `toDataURL`.
* Enable this option may reduce performance.
*/
constructor(canvas: HTMLCanvasElement | OffscreenCanvas, enableCapture: boolean) {
constructor(
canvas: HTMLCanvasElement | OffscreenCanvas,
enableCapture: boolean,
) {
const gl =
canvas.getContext("webgl2", {
alpha: false,