Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove src/TaskQueue #5826

Merged
merged 2 commits into from May 7, 2020
Merged

chore: remove src/TaskQueue #5826

merged 2 commits into from May 7, 2020

Conversation

jackfranklin
Copy link
Collaborator

The only place it's used is in src/Page.ts to have a chain of
screenshot promises. Rather than initialize a task queue in Browser
and pass it through a chain of constructors we instead move the class
into src/Page and define it inline.

In the future we might want to create a helpers folder to contain small
utilities like that (src/Page.ts is already far too large) but I'm
leaving that for a future PR.

TaskQueue isn't documented in api.md so I don't think this is a
breaking change.

I updated the type of screenshot() to return Promise<string | Buffer | void> because if a promise rejects it's silently swallowed. I'd like
to change this behaviour but one step at a time. This type only had to
change as now we type the screenshot task queue correctly rather than
using any which then exposed the incorrect screenshot() types.

The only place it's used is in `src/Page.ts` to have a chain of
screenshot promises. Rather than initialize a task queue in `Browser`
and pass it through a chain of constructors we instead move the class
into `src/Page` and define it inline.

In the future we might want to create a helpers folder to contain small
utilities like that (`src/Page.ts` is already far too large) but I'm
leaving that for a future PR.

`TaskQueue` isn't documented in `api.md` so I don't think this is a
breaking change.

I updated the type of `screenshot()` to return `Promise<string | Buffer
| void>` because if a promise rejects it's silently swallowed. I'd like
to change this behaviour but one step at a time. This type only had to
change as now we type the screenshot task queue correctly rather than
using `any` which then exposed the incorrect `screenshot()` types.
@jackfranklin jackfranklin merged commit 49ce659 into master May 7, 2020
@jackfranklin jackfranklin deleted the remove-task-queue branch May 7, 2020 13:49
dmitrysteblyuk pushed a commit to dmitrysteblyuk/puppeteer that referenced this pull request Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants