diff --git a/tooling/api/src/webview.ts b/tooling/api/src/webview.ts index 3200ed72c..f03fc7d96 100644 --- a/tooling/api/src/webview.ts +++ b/tooling/api/src/webview.ts @@ -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 () { diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index 4506f8541..fa28d931c 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -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 * });