mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-11 10:43:31 +02:00
fix(docs): fix API webview/window class doc example (#8971)
* fix class doc example * fix class doc example
This commit is contained in:
@@ -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 () {
|
||||
|
||||
@@ -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
|
||||
* });
|
||||
|
||||
Reference in New Issue
Block a user