38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
#include "rktwebview.h"
|
|
#include <stdio.h>
|
|
|
|
int main()
|
|
{
|
|
rkt_webview_t *wv = rkt_create_webview();
|
|
result_t r = rkt_webview_navigate(wv, "https://wikipedia.org");
|
|
|
|
rkt_webview_t *wv1 = nullptr;
|
|
//result_t r = rkt_set_html(wv, "<html><head><title>He daar!</title></head><body><h1>He daar!</h1></body>");
|
|
printf("Navigate: result = %d\n", r);
|
|
int i = 0;
|
|
while(rkt_webview_valid(wv)) {
|
|
printf("Waiting...%d\n", i);
|
|
#ifdef USE_WIN_THREADS
|
|
Sleep(1000);
|
|
#endif
|
|
#ifdef USE_PTHREADS
|
|
usleep(1000 * 1000);
|
|
#endif
|
|
i += 1;
|
|
if (i > 5) {
|
|
item_t item = rkt_webview_call_js(wv, "{ window.location = 'https://dijkewijk.nl'; return 42; }");
|
|
printf("%d, %s\n", item.context, item.data);
|
|
rkt_webview_destroy_item(item);
|
|
item_t item1 = rkt_webview_call_js(wv, "{ return stuffwrong + 5 }");
|
|
printf("%d, %s\n", item1.context, item1.data);
|
|
rkt_webview_destroy_item(item1);
|
|
}
|
|
if (i == 16) {
|
|
wv1 = rkt_create_webview();
|
|
result_t r = rkt_webview_navigate(wv, "https://www.cs.cmu.edu/afs/cs/academic/class/15492-f07/www/pthreads.html");
|
|
}
|
|
|
|
}
|
|
return 0;
|
|
}
|