snipplets.dev/code/C/webui/minimal.c

25 lines
507 B
C

#include <stdio.h>
#include "webui.h"
void fn_one(webui_event_t *e) {
const char *str = webui_get_string(e);
printf("Data from JavaScript: %s\n", str);
webui_return_string(e, "Message from C");
}
void fn_two(webui_event_t *e) { puts("Click!"); }
int main() {
size_t my_window = webui_new_window();
webui_bind(my_window, "MyID", fn_one);
webui_bind(my_window, "clck", fn_two);
webui_show(my_window, "index.html");
webui_run(my_window, "alert('Fast!');");
webui_wait();
return 0;
}