Hello!
I have a method class element:

class Element{ constructor(element){ this.element = element; } setVisible(){ this.element.setAttribute('style', 'visibility:visible;'); } setHidden(){ this.element.setAttribute('style', 'visibility:hidden;'); } setParrent(parrent){ this.parrent = parrent; } setServerScript(script){ this.script = script; } //и т.д. очень много методов штук 100 } 

Various classes are inherited from it for DOM elements, in which objects, in consequence, only 20% of those methods used in the parent class are used.
The question is - is it bad in terms of code organization? Is it necessary to apply a lightweight pattern in this case, for example?
And the second question - do these unused methods eat memory? And, if, yes - how to find out how much? Preferably using google wev tools.
Thank!

  • one
    In my opinion, it will be saving on matches - gil9red September
  • gil9red, yes, it is possible. And how to estimate how many matches we save? I am currently reading the web tools manual, but if there is a hint, it would be very useful))) - OO
  • As far as I know, with prototype inheritance (and here we have it), methods are created in a single copy. Accordingly, you can create as many instances as you need - methods will no longer be taken up in memory. - Stepan Kasyanenko

0