diff --git a/examples/wasm/mandelbrot/README.md b/examples/wasm/mandelbrot/README.md index 9b7f0dda5f..ac84f0efc6 100644 --- a/examples/wasm/mandelbrot/README.md +++ b/examples/wasm/mandelbrot/README.md @@ -3,7 +3,7 @@ ## Using only V ``` -v run main.v +v run . ``` ## Using Python or Emscripten diff --git a/examples/wasm/mandelbrot/favicon.ico b/examples/wasm/mandelbrot/favicon.ico new file mode 100644 index 0000000000..d3f932a47b Binary files /dev/null and b/examples/wasm/mandelbrot/favicon.ico differ diff --git a/examples/wasm/mandelbrot/main.v b/examples/wasm/mandelbrot/main.v deleted file mode 100644 index a3a8988ca7..0000000000 --- a/examples/wasm/mandelbrot/main.v +++ /dev/null @@ -1,29 +0,0 @@ -module main - -import vweb -import os - -const http_port = 3001 - -struct App { - vweb.Context -} - -fn main() { - vweb.run(new_app(), http_port) -} - -fn new_app() &App { - mut app := &App{} - - os.execute_or_panic('v -b wasm -os browser mandelbrot.wasm.v') - - app.mount_static_folder_at(os.resource_abs_path('./'), '/') - return app -} - -@['/'; get] -pub fn (mut app App) controller_mandelbrot() !vweb.Result { - file := os.read_file('mandelbrot.html') or { panic(err) } - return app.html(file) -} diff --git a/examples/wasm/mandelbrot/mandelbrot.html b/examples/wasm/mandelbrot/mandelbrot.html index 5bc8c53d57..2686cde852 100644 --- a/examples/wasm/mandelbrot/mandelbrot.html +++ b/examples/wasm/mandelbrot/mandelbrot.html @@ -7,21 +7,24 @@ V Mandelbrot WebAssembly Example +

Below you should see the picture of the Mandelbrot set, +
calculated in WASM, and shown in a Canvas element.