5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 07:40:17 +08:00

Give explicity example of importing JS runtime (#3178)

* Give explicity example of importing JS runtime

No where in the docs, google, github issues or discussions could I find an example of importing the runtime JS but after some experimentation I figured it out.

I think it would help future users if a simple example was shown like this so they have a clear reference of how to import the runtime.

* make generic

* Update changelog.mdx

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
This commit is contained in:
Dana Woodman 2024-01-17 03:40:12 -08:00 committed by GitHub
parent b498cddcad
commit f9aa4d3b60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add Apple Silicon hardware detection to `wails doctor`. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3129) - Add Apple Silicon hardware detection to `wails doctor`. Changed by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3129)
- Remove quarantine attribute on macOS binaries. Changed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3118) - Remove quarantine attribute on macOS binaries. Changed by @leaanthony in [PR](https://github.com/wailsapp/wails/pull/3118)
- Added documentation for a common GStreamer error on Linux systems. Changed by [@mkwsnyder](https://github.com/mkwsnyder) in [PR](https://github.com/wailsapp/wails/pull/3134) - Added documentation for a common GStreamer error on Linux systems. Changed by [@mkwsnyder](https://github.com/mkwsnyder) in [PR](https://github.com/wailsapp/wails/pull/3134)
- Added documentation on explicity example of importing JS runtime. Changed by [@danawoodman](https://github.com/danawoodman) in [PR](https://github.com/wailsapp/wails/pull/3178)
- Add dock icon right-click exit handling by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3157) - Add dock icon right-click exit handling by @almas1992 in [PR](https://github.com/wailsapp/wails/pull/3157)
### Fixed ### Fixed

View File

@ -34,6 +34,13 @@ The JavaScript library is available to the frontend via the `window.runtime` map
mode that provides TypeScript declarations for the runtime. This should be located in the `wailsjs` directory in your mode that provides TypeScript declarations for the runtime. This should be located in the `wailsjs` directory in your
frontend directory. frontend directory.
e.g. if you wanted to import the [EventsOn](./events/#eventson) function in your frontend, you can do the following:
```ts
// src/index.js (for example)
import { EventsOn } from '../wailsjs/runtime'
```
### Hide ### Hide
Go: `Hide(ctx context.Context)`<br/> Go: `Hide(ctx context.Context)`<br/>