Using the Google closure compiler and library for inheritance I found two different calls of super constructor in a lot of closure based libraries (forgot where I found it). Not sure if I got it wrong at all.
What is the difference and what is the correct one to use?
// Xhrio extends EventTarget
goog.events.EventTarget.call(this);
goog.net.XhrIo.base(this, 'constructor');
Either one is fine. I suppose you might say the second one is slightly better because if you later changed
XhrIo
to extend something other thanEventTarget
you might not have to change that line.You can also use
goog.base(this, 'constructor')
but that is incompatible with strict mode.