-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestapp.c
More file actions
38 lines (25 loc) · 758 Bytes
/
testapp.c
File metadata and controls
38 lines (25 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "wui.h"
#include <stdio.h>
#include <string.h>
const char* test_html = "<h1>test</h1>";
const char* bind_callback(const char* json) {
printf("args: %s\n", json);
return "null";
}
bool on_asset_request(const char * url, const char ** pcontent_type, const uint8_t** pdata, size_t * psize) {
printf("asset request: %s\n", url);
*pcontent_type = "text/html";
*pdata = (const uint8_t*)test_html;
*psize = strlen(test_html);
return true;
}
int main() {
wui_enable_debug(true);
wui_handle_t w = wui_new();
wui_handle_t w2 = wui_new();
wui_set_html(w, "hello world from c!");
wui_bind_function(w, "test", bind_callback);
wui_on_asset_requested(w, on_asset_request);
wui_os_loop();
return 0;
}