-
-
Notifications
You must be signed in to change notification settings - Fork 742
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
Persist cookies + localStorage plugin #804
base: master
Are you sure you want to change the base?
Persist cookies + localStorage plugin #804
Conversation
Tricky ways to listen of new cookies/local storage
factory to construct storage engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, here is some code for IndexedDB: https://github.com/clouedoc/puppeteer-extra-plugin-session/blob/master/src/providers/indexedDb.ts
- Do not use tslint; use ESLint with typescript-eslint instead. This is because TSLint is now deprecated. Rush Stack has a great starter ESLint file.
- Polling might be a bit aggressive
- IIRC NodeJS 20 has a built-in testing tool
- Storage engines feel out of scope. The responsibility is better left to the user, or there will be complaints in GitHub issues. Of course, that's only my opinion; I appreciate the value of having storage engines available out-of-the-shelf 🙂
todo: make a PR to puppeteer-extra to change the PluginData interface, name and value should not be an object but any instead.
No, it should be unknown to force the developer to do a type assertion.any
s are to be avoided at all costs. Every time you commit an any
, a developer at the end of the world gets depression.
To learn this kind of stuff, I highly recommend the book Efficient TypeScript
In this specific case, you should have created an interface with the structure of how your plugin options should look like.
In any case, enormous props for submitting your code 🙂
You are very welcome in our small community 👍
Hello everybody,
The ways to retrieve new cookies/localStorage are a bit tricky but I didn't find any other better solution, yet.
If you have any idea do not hesitate I can implement them.
The plugin is available here meanwhile the PR is merged :
https://www.npmjs.com/package/puppeteer-extra-plugin-session-persistence
This is my first code on TypeScript I am not really used to it, do not hesitate to tell me how can I improve this code !
#459