Skip to content

Commit

Permalink
docs: improve instructions, fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 3, 2023
1 parent f5e4d97 commit f47d54b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,29 @@ purpose programming language with modern web technologies to design a graphical

**Webview Module**

- From source
- Install the module

```sh
# From source
v install --git https://github.com/ttytm/webview
# Or as vpm package
v install ttytm.webview
```

- Or as vpm package
- After the installation, build the webview C library to which the webview V module will bind.\
You can re-run the script at any point to rebuild the parent library with the latest upstream
changes.

```sh
v install ttytm.webview
# For installations from source
~/.vmodules/webview/build.vsh
# For installations as vpm module
~/.vmodules/ttytm/webview/build.vsh
# PowerShell might require to prefix the script with `v`, e.g.:
v $HOME/.vmodules/webview/build.vsh
```

## Usage

After the installation, build the webview C library to which the webview V module will bind.\
You can re-run the script at any point to rebuild the library with the latest upstream changes.

```sh
# For installations from source
~/.vmodules/webview/build.vsh
# For installations as vpm module
~/.vmodules/ttytm/webview/build.vsh
# PowerShell might require to prefix the script with `v`, e.g.:
v $HOME/.vmodules/webview/build.vsh
```

### Usage Example
## Usage Example

> **Note**
> When running and building on Windows, it is recommended to use `gcc` for compilation. E.g.:
Expand Down Expand Up @@ -134,8 +130,8 @@ file and on its [vdoc site](https://ttytm.github.io/webview/webview.html).
## Debugging
Use the `webview_debug` flag to enable developer tools
(allowing _right click_ <kbd>Inspect Element</kbd>) and `console.log` prints to the terminal. E.g.:
Use the `webview_debug` flag to enable developer tools -
enabling _right click_ <kbd>Inspect Element</kbd> and `console.log` prints to the terminal. E.g.:
```sh
v -d webview_debug run .
Expand All @@ -145,9 +141,9 @@ Alternatively, control the debug mode explicitly for a window by creating it wit
argument.
```v ignore
webview.create() // enabled when the appliction was build with `-d webview_debug`
webview.create() // enabled when the application was build with `-d webview_debug`
webview.create(debug: true) // explicitly enabled for the window
webview.create(debug: false) // explicitly disabled for the window
webview.create(debug: false) // explicitly disabled for the window, even when built with `-d webview_debug`
```
> **Note**
Expand Down
2 changes: 1 addition & 1 deletion examples/v-js-interop-simple/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const doc = '<!DOCTYPE html>
<script>
// Functions that are declared in JS can also be called from your V program.
function myJsFunction(myStrArg) {
// NOTE: Building in debug mode enables developer tools for a winodw.
// NOTE: Building in debug mode enables developer tools for a window.
// Also, console.log will additionally be printed to the terminal.
// This feature currently works with Linux and Windows.
console.log("Called myJsFunction:", myStrArg);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.v
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ enum ReturnKind {
}

// copy_char copies a C style string. The functions main use case is passing an `event_id &char`
// to another thread. It helps to keep the event id available when executing `@retrun`
// to another thread. It helps to keep the event id available when executing `@return`
// from the spawned thread. Without copying the `event_id` might get obscured during garbage
// collection and returning data to a calling JS function becomes error prone.
fn copy_char(s &char) &char {
Expand Down

0 comments on commit f47d54b

Please sign in to comment.