samedi 11 janvier 2020

decorating classes from a libary? javascript

I am using puppeteer for a webcrawler of mine. sometimes it needs to click gui elements that take time to show up.

It has been bugging me that for every click() I call I also need to call a timeout manually. I wondered if it is possible to decorate all the click functions somehow.

As puppeteer is a library I do not instantiate any of these myself, rather they're given from functions such as Page.$(selector) the click() is available in multiple classes and all of them will need to have it applied.

what's a good pattern to solve this?

I am struggling with keywords for google. Any direction is greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire