Empty Handlers in OpenLaszlo 4.1

The current release of OpenLaszlo doesn’t like empty handler tags. If you compile the following code, you’ll get a compiler warning:

<canvas debug="true">
    <handler name="oninit">

    </handler>
</canvas>

The warning will say:

“Refusing to compile an empty handler, you should declare the event instead”

This wasn’t the case previously. The warning is intended to educate developers who continue to define empty handlers to “hack” a custom event. (This is an old practice that is no longer necessary, since there is now an <event /> tag). If you’re intentionally writing empty handler tags (e.g. as stubs), those warnings may get in the way.

To work around them, provide a comment in your empty handler:

<canvas debug="true">
    <handler name="oninit">
        // Setup code for application.
    </handler>
</canvas>

2 thoughts on “Empty Handlers in OpenLaszlo 4.1

Leave a Reply

Your email address will not be published. Required fields are marked *