7 ms·
There is no need for you to create a new class to represent a resource. Javascript doesn't require objects to be instances of specific classes, so you can just
by Timon3 3y ago
There is no need for you to create a new class to represent a resource. Javascript doesn't require objects to be instances of specific classes, so you can just return an object with the dispose method while only using it as a container. Even when using Typescript there is no need to add a new class, a new type declaration is more than sufficient.
Just because it's on objects doesn't mean it's OOP.