You have a bunch of online services that let you take screenshots of a site and save them in a folder. While it can be very useful to pay for such a system, it is not so hard to create it. Let’s use Chrome / Chromium with Puppeteer and Node.js (cluster) to take some snapshots in no-time. We’ll use the Puppeteer Cluster package to run multiple threads / workers to grab those screens in parallel. We’ll be using TypeScript.
Have you tried turning it on and off again? The web is a weird place and calls might not always succeed in the right manner. A retry with an exponential back-off mechanism helps your code to be more resilient when it connects to services outside of your control. While there are many packages that can help in this area, it pretty easy to add some utility methods to your project. In this article I’ll show how you can create a general-purpose exponential back-off and retry mechanism using TypeScript and Node.js.
Lately we’ve been playing around with ChatOps at Wehkamp. We added a Hubot to our Slack channels to automate some operational jobs. It makes work more fun and way easier. As it is hosted in our own infrastructure, it can interact with our micro-services. In this article I explore how to use ES6 and a Promise to implement a call to a simple web-service.
But what if you need a TypeScript script that supports both vanilla browser JS and Node.js? What if you need to expose 10+ classes?