From 9dbcc585b86bb4e020aa0cdfc7a355172346cdc9 Mon Sep 17 00:00:00 2001 From: ful1e5 <24286590+ful1e5@users.noreply.github.com> Date: Fri, 13 Nov 2020 09:35:21 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Optimize=20browser=20rendering?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/BitmapsGenerator.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/core/src/BitmapsGenerator.ts b/packages/core/src/BitmapsGenerator.ts index 7397e71d..4cb1f60e 100644 --- a/packages/core/src/BitmapsGenerator.ts +++ b/packages/core/src/BitmapsGenerator.ts @@ -96,9 +96,8 @@ export class BitmapsGenerator { // Render spinner.text = ` Rendering ${chalk.greenBright(cursor)}`; await svgElement.screenshot({ omitBackground: true, path: out }); + await this.closeAllPages(browser); } - - await this.closeAllPages(browser); } /** @@ -141,7 +140,7 @@ export class BitmapsGenerator { // Pushing frames until it match to 1st frame index++; - // Minimum frames no. = 5 + // Minimum frames no. = 15 while (!breakRendering) { const key = getFrameName(index, cursor); spinner.text = ` Rendering ${chalk.greenBright(key)}`; @@ -156,7 +155,7 @@ export class BitmapsGenerator { img2Buff: newFrame }); - if (matched && !normalAnimatedCursors.includes(cursor) && index > 5) { + if (matched && !normalAnimatedCursors.includes(cursor) && index > 15) { breakRendering = true; } else if (matched && index > this.minimumFrames) { breakRendering = true; @@ -167,9 +166,8 @@ export class BitmapsGenerator { } this.saveFrames(frames); + await this.closeAllPages(browser); } - - await this.closeAllPages(browser); } /**