To those looking this question first I'm trying to find a correct OOP model I can use in JS. I initially found a very different solution from what's normally done and I received lots of help from some of the good guys here :)
The links above tell the whole story.
from @tkelleheFrom @tkellehe's and @SirPython@SirPython's answers:
from @tkelleheFrom @tkellehe's answer:
- I remove all _vars
_var
s from parameters, all private vars will use it from now on. Just there aren't any at the example at the moment.
- I used Object.define
Object.define
in Viewthe View
classes so I don't need to use Object.keysObject.keys
anymore.
- Because I reverted to this, new and prototype usage, override function doesn't work/it's not needed anymore. So I had to use Class.prototype.method.call
Class.prototype.method.call
instead and I don't need a Basebase class anymore or a salvage to not using new. At least at this point.
- I know loading within context is important and I'll use it. I just don't think it's needed for this example. But that library loading function was really cool. Thanks.
- I don't like using Class.prototype.method.call
Class.prototype.method.call
. It's too long... and too clumsy. Is there a better solution for calling the superior method ? Can you make override function work again in this format ?
- In ViewCallthe
ViewCall
and ViewBaseViewBase
classes, it would be better if I could put this.parse()this.parse()
in ViewBasethe ViewBase
class in such a manner that it get called in the moment ViewClassViewClass
was instatiated. But I couldn't find a way to do it. Someone hasDoes anyone have an idea on how I could do this ?
Better ? comments ?