You can specify how to deserialize and paint a component with the Load Type property, which has the following options and recommended usages:
- Normal deserialize and paint with the parent. This is the only behavior in General Interface 3.4 and earlier.
- Paint Asynchronously deserialize with the parent and paint after sleep. This option improves the "pop" of a component since painting a DOM branch can be slow. Deserializing with the parent increases backward compatibility, because the DOM always appears the same as it would with the Normal setting.
- Deserialize Asynchronously deserialize and paint after sleep. This option further improves "pop" of a component by offloading the deserialization step to an asynchronous operation. However, it may be inconvenient to the developer for the DOM to exist momentarily in an incomplete state.
This option is the recommended setting for the content pane of a dialog or other components where loading needs to provide immediate feedback and a screen flicker is acceptable. This is the closest equivalent to loading a referenced component asynchronously in General Interface 3.4 and earlier.
- Paint and Deserialize Asynchronously deserialize after sleep and paint after another sleep. This option is similar to the Deserialize Asynchronously option, except the CPU rests after deserializing and before paint. This option is the recommended setting for very large DOM branches that take a long time to deserialize.
- Paint on Show deserialize with parent and paint on show. This option offloads painting of a DOM branch until the result of the paint is visible.
This option is the recommended setting for the content panes of Tabs and Stacks.
- Deserialize on Show deserialize and paint on show. This option is similar to the Paint on show option, but deserialization is also offloaded until the component is shown. This could increase "pop" even more than the Paint on show option, but it may be inconvenient to the developer for the DOM to exist momentarily in an incomplete state.
By default, the Dialog component is set to Paint Asynchronously and Tab and Stack are set to Paint on Show in General Interface Builder.
Recommended Usage
Follow these recommended usages when specifying load type for components:
- For increased "pop," use Paint Asynchronously, Deserialize Asynchronously, or Paint and Deserialize Asynchronously.
- To display a dialog and then its content, use Paint Asynchronously, Deserialize Asynchronously, or Paint and Deserialize Asynchronously on the Block that contains the content of the dialog.
- For the content panes of Tabs and Stacks, use Paint on Show or Deserialize on Show.
You can also use the jsx3.app.Model.getLoadType() and jsx3.app.Model.setLoadType() methods to get and set the load type programmatically. For more information, see General Interface API Reference.