From 88178c2b3fadb0750de60c0045273978e159b6f8 Mon Sep 17 00:00:00 2001 From: Dana Woodman Date: Sat, 6 Jan 2024 21:45:51 -0800 Subject: [PATCH] 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. --- .../version-v2.7.0/reference/runtime/intro.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/website/versioned_docs/version-v2.7.0/reference/runtime/intro.mdx b/website/versioned_docs/version-v2.7.0/reference/runtime/intro.mdx index 3c491ecf046..eb117e971dc 100644 --- a/website/versioned_docs/version-v2.7.0/reference/runtime/intro.mdx +++ b/website/versioned_docs/version-v2.7.0/reference/runtime/intro.mdx @@ -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 frontend directory. +e.g. if you wanted to import the [EventsOn](./events/#eventson) function in a Svelte app, you can do the following: + +```ts +// src/App.svelte (for example) +import { EventsOn } from '../wailsjs/runtime' +``` + ### Hide Go: `Hide(ctx context.Context)`