By adding this extension to ViewRegistry::getView we're paving the way for
Etch-like view frameworks which promotes the usage of plain objects and
classes with an element property which is an instance of HTMLElement.
A common pattern is to put something on the DOM, measure it, then update
the DOM again based on that measurement. This change ensures that any
updates requested as a result of reading from the DOM get scheduled for
the end of the current frame. If you want to read *again* after these
follow-on updates, you will need to wait for the next frame. But at
least this way we ensure instant feedback with minimal thrashing
(1 reflow) when we have no choice but to read the DOM before updating.
/cc @benogle
The blinking cursor was ensuring that we never polled in certain cases.
We need to allow the interval to continue polling at a normal pace, but
just avoid doing any work that could delay the next animation frame.
This property is added as needed in our legacy SpacePen views, and is
now used to trigger a deprecation warning. We don’t want to add it to
new SpacePen views because they shouldn’t trigger deprecation warnings.
It now takes two arguments, a model constructor and a create view
callback that is passed the model.
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
If present, it will be called with the model object instead of
instantiating the view constructor directly and assigning a model on it.
This gives users more flexibility when constructing views.
It’s a more technically correct term. You use a class keyword to declare
these things, but the actual objects you pass around to talk about them
are constructor functions.