update C snipplets
This commit is contained in:
24
code/C/Web/webui/minimal.c
Normal file
24
code/C/Web/webui/minimal.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user