fix(docs): fix API webview/window class doc example (#8971)

* fix class doc example

* fix class doc example
This commit is contained in:
i-c-b 2024-02-24 15:36:45 -05:00 committed by GitHub
parent f5e4b67203
commit 9cc014f2df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 18 deletions

View File

@ -93,9 +93,9 @@ export type WebviewLabel = string
* import { Window } from "@tauri-apps/api/window"
* import { Webview } from "@tauri-apps/api/webview"
*
* // loading embedded asset:
* const appWindow = new Window('uniqueLabel')
* const appWindow = new Window('uniqueLabel');
*
* // loading embedded asset:
* const webview = new Webview(appWindow, 'theUniqueLabel', {
* url: 'path/to/page.html'
* });
@ -112,9 +112,9 @@ export type WebviewLabel = string
* });
*
* // emit an event to the backend
* await webview.emit("some event", "data");
* await webview.emit("some-event", "data");
* // listen to an event from the backend
* const unlisten = await webview.listen("event name", e => {});
* const unlisten = await webview.listen("event-name", e => {});
* unlisten();
* ```
*
@ -136,7 +136,7 @@ class Webview {
* import { Window } from '@tauri-apps/api/window'
* import { Webview } from '@tauri-apps/api/webview'
* const appWindow = new Window('my-label')
* const webview = new Window(appWindow, 'my-label', {
* const webview = new Webview(appWindow, 'my-label', {
* url: 'https://github.com/tauri-apps/tauri'
* });
* webview.once('tauri://created', function () {

View File

@ -235,14 +235,9 @@ export type WindowLabel = string
*
* @example
* ```typescript
* // loading embedded asset:
* const appWindow = new Window('theUniqueLabel', {
* url: 'path/to/page.html'
* });
* // alternatively, load a remote URL:
* const appWindow = new Window('theUniqueLabel', {
* url: 'https://github.com/tauri-apps/tauri'
* });
* import { Window } from "@tauri-apps/api/window"
*
* const appWindow = new Window('theUniqueLabel');
*
* appWindow.once('tauri://created', function () {
* // window successfully created
@ -252,9 +247,9 @@ export type WindowLabel = string
* });
*
* // emit an event to the backend
* await appWindow.emit("some event", "data");
* await appWindow.emit("some-event", "data");
* // listen to an event from the backend
* const unlisten = await appWindow.listen("event name", e => {});
* const unlisten = await appWindow.listen("event-name", e => {});
* unlisten();
* ```
*
@ -272,9 +267,7 @@ class Window {
* @example
* ```typescript
* import { Window } from '@tauri-apps/api/window';
* const appWindow = new Window('my-label', {
* url: 'https://github.com/tauri-apps/tauri'
* });
* const appWindow = new Window('my-label');
* appWindow.once('tauri://created', function () {
* // window successfully created
* });