# Handling events in Prolog

This demo illustrates event handling using the Tau-Prolog compatible `library(dom)`. We show two versions, one using exclusively the Tau-Prolog module and one using SWI-Prolog's general calling to JavaScript.

If you click the buttons, the label of the clicked button is changed.

## Using Tau-Prolog library(dom)

This version uses Tau-Prolog library(dom) library to manipulate the DOM and bind the event handling.

## Using SWI-Prolog's JavaScript binding

This versions uses SWI-Prolog's general JavaScript interface for manipulating the DOM. Note that `bind/4` is part of the low level `library(wasm)`. In addition, `library(wasm)` provides `bind_async/4` which makes the event-handler create a new asynchronous task.