Use the deferred Attribute

If you still need to write zscript codes, you can specify the deferred attribute to defer the evaluation of zscript codes as follows.

<zscript deferred="true">
...

By specifying the deferred attribute, the zscript codes it contains will not be evaluated when ZK renders a pags. It means the interpreter won't be loaded when ZK renders a page. It saves memory and speeds up the page rendering.

In the following example, the interpreter is loaded only when the button is clicked:

<window id="w">
    <zscript deferred="true">    
    void addMore() {    
        new Label("More").setParent(w);        
    }    
    </zscript>    
    <button label="Add" onClick="addMore()"/>    
</window>