DEV Community

Discussion on: Fetch - from simple to scalable implementation

nombrekeff profile image
Keff Author

Hey, peter! I'm glad you liked it

I don't know If I understand the question correctly, I will answer what I think you meant, but please let me know if it wasn't this, I'm happy to resolve any questions you have!

Do you mean creating a fetcher object using a constructor function (class) instead, something like this:

class Fetcher {
   get(uri, options) {

const fetcher = new Fetcher();
Enter fullscreen mode Exit fullscreen mode

If so, the answer is yes, you can do it in many ways, depending on many factors, like the codebase you already have, do you follow any practice that forces you to do it one way or another, etc...

I'm currently working on a post similar to this one but in an object-oriented approach. In this example, I stuck to functions to make it clearer, as OOP has more code and is a bit more difficult to follow!

I will let you know when I post it so you can see the different approach.

proto133 profile image
Peter Roto

This answered my question. Thank you so much for your reply.