Skip to content

Commit 1fed94b

Browse files
new_lib_version
1 parent 9a94135 commit 1fed94b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Download the latest version of [c2wasm.c](https://github.com/OUIsolutions/C2Wasm
5959
Create a `test.c` file in the same directory where you saved `c2wasm.c`:
6060

6161
```c
62+
6263
#include "c2wasm.c"
6364
#include <stdio.h>
6465

@@ -69,7 +70,12 @@ long set_div_value() {
6970

7071
// Get the DOM element with id "test_div"
7172
c2wasm_js_var element = c2wasm_call_object_prop(c2wasm_document, "getElementById", find_args);
73+
if(c2wasm_instance_of(element, c2wasm_error)) {
74+
printf("Error: Element not found\n");
75+
return c2wasm_undefined;
76+
}
7277

78+
7379
// Set the innerHTML of the element
7480
c2wasm_set_object_prop_string(element, "innerHTML", "Hello World from C");
7581

0 commit comments

Comments
 (0)