RE: alternate view on constructors for custom elements

From: Travis Leithead [mailto:travis.leithead@microsoft.com]

> if super() is absolutely required for a constructor in a class
> that extends something, is there a requirement about when in the
> constructor method it be invoked? Must it always be the first call? Can it be
> later on, say at the end of the function?

It must be before `this` is referenced.

> Basically, like this (reverting to non-class syntax):

Yeah, and at that point you might as well make it a method on the actual class, and give it a nice name, like, say, createdCallback ;). Or, make it a function that takes the element as a parameter, and keep it separate from the class, perhaps in a "hooks" object ;).

Received on Friday, 17 July 2015 20:23:35 UTC