Skip to content
SiteEmail

Some JavaScript methods require browsers to do an Immediate Layout to yield correct results. Gameface doesn’t do that by default as a layout is an expensive operation, but it is possible to enable the behavior on demand as third-party JavaScript libraries might depend on it.

When Immediate Layout is enabled all getters from the list here execute a layout before returning a value.

The default behavior is a view setting, so changing it affects all documents loaded in a view. It can be set by:

  1. By calling the engine.enableImmediateLayout and engine.isImmediateLayoutEnabled methods.
  2. By calling the ImmediateLayout property in the cohtml.Net.ViewSettings class.

What is more, an immediate layout can be triggered on demand through the engine.executeImmediateLayoutSync method.

Enabling Immediate Layout will trigger a layout on each getter which might be rather expensive. This is the easiest way to test how a third-party library works.

A more optimal workflow would be to perform as many changes as possible, then doing a single engine.executeImmediateLayoutSync and then calling getters many times. With that flow, a single layout is executed and the performance of an application should improve.