99 *
1010 * Events can be listened to using {@link Webview.listen}:
1111 * ```typescript
12- * import { getCurrent } from "@tauri-apps/api/webview";
13- * getCurrent ().listen("my-webview-event", ({ event, payload }) => { });
12+ * import { getCurrentWebview } from "@tauri-apps/api/webview";
13+ * getCurrentWebview ().listen("my-webview-event", ({ event, payload }) => { });
1414 * ```
1515 *
1616 * @module
@@ -29,7 +29,7 @@ import {
2929 once
3030} from './event'
3131import { invoke } from './core'
32- import { Window , getCurrent as getCurrentWindow } from './window'
32+ import { Window , getCurrentWindow } from './window'
3333import { WebviewWindow } from './webviewWindow'
3434
3535interface DragDropPayload {
@@ -53,7 +53,7 @@ type DragDropEvent =
5353 *
5454 * @since 2.0.0
5555 */
56- function getCurrent ( ) : Webview {
56+ function getCurrentWebview ( ) : Webview {
5757 return new Webview (
5858 getCurrentWindow ( ) ,
5959 window . __TAURI_INTERNALS__ . metadata . currentWebview . label ,
@@ -69,7 +69,7 @@ function getCurrent(): Webview {
6969 *
7070 * @since 2.0.0
7171 */
72- function getAll ( ) : Webview [ ] {
72+ function getAllWebviews ( ) : Webview [ ] {
7373 return window . __TAURI_INTERNALS__ . metadata . webviews . map (
7474 ( w ) =>
7575 new Webview ( Window . getByLabel ( w . windowLabel ) ! , w . label , {
@@ -184,30 +184,30 @@ class Webview {
184184 * @returns The Webview instance to communicate with the webview or null if the webview doesn't exist.
185185 */
186186 static getByLabel ( label : string ) : Webview | null {
187- return getAll ( ) . find ( ( w ) => w . label === label ) ?? null
187+ return getAllWebviews ( ) . find ( ( w ) => w . label === label ) ?? null
188188 }
189189
190190 /**
191191 * Get an instance of `Webview` for the current webview.
192192 */
193193 static getCurrent ( ) : Webview {
194- return getCurrent ( )
194+ return getCurrentWebview ( )
195195 }
196196
197197 /**
198198 * Gets a list of instances of `Webview` for all available webviews.
199199 */
200200 static getAll ( ) : Webview [ ] {
201- return getAll ( )
201+ return getAllWebviews ( )
202202 }
203203
204204 /**
205205 * Listen to an emitted event on this webview.
206206 *
207207 * @example
208208 * ```typescript
209- * import { getCurrent } from '@tauri-apps/api/webview';
210- * const unlisten = await getCurrent ().listen<string>('state-changed', (event) => {
209+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
210+ * const unlisten = await getCurrentWebview ().listen<string>('state-changed', (event) => {
211211 * console.log(`Got error: ${payload}`);
212212 * });
213213 *
@@ -241,7 +241,7 @@ class Webview {
241241 *
242242 * @example
243243 * ```typescript
244- * import { getCurrent } from '@tauri-apps/api/webview';
244+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
245245 * const unlisten = await getCurrent().once<null>('initialized', (event) => {
246246 * console.log(`Webview initialized!`);
247247 * });
@@ -276,8 +276,8 @@ class Webview {
276276 *
277277 * @example
278278 * ```typescript
279- * import { getCurrent } from '@tauri-apps/api/webview';
280- * await getCurrent ().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
279+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
280+ * await getCurrentWebview ().emit('webview-loaded', { loggedIn: true, token: 'authToken' });
281281 * ```
282282 *
283283 * @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
@@ -303,8 +303,8 @@ class Webview {
303303 *
304304 * @example
305305 * ```typescript
306- * import { getCurrent } from '@tauri-apps/api/webview';
307- * await getCurrent ().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
306+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
307+ * await getCurrentWebview ().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });
308308 * ```
309309 *
310310 * @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.
@@ -350,8 +350,8 @@ class Webview {
350350 * The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop.
351351 * @example
352352 * ```typescript
353- * import { getCurrent } from '@tauri-apps/api/webview';
354- * const position = await getCurrent ().position();
353+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
354+ * const position = await getCurrentWebview ().position();
355355 * ```
356356 *
357357 * @returns The webview's position.
@@ -367,8 +367,8 @@ class Webview {
367367 * The client area is the content of the webview, excluding the title bar and borders.
368368 * @example
369369 * ```typescript
370- * import { getCurrent } from '@tauri-apps/api/webview';
371- * const size = await getCurrent ().size();
370+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
371+ * const size = await getCurrentWebview ().size();
372372 * ```
373373 *
374374 * @returns The webview's size.
@@ -388,8 +388,8 @@ class Webview {
388388 * Closes the webview.
389389 * @example
390390 * ```typescript
391- * import { getCurrent } from '@tauri-apps/api/webview';
392- * await getCurrent ().close();
391+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
392+ * await getCurrentWebview ().close();
393393 * ```
394394 *
395395 * @returns A promise indicating the success or failure of the operation.
@@ -405,7 +405,7 @@ class Webview {
405405 * @example
406406 * ```typescript
407407 * import { getCurrent, LogicalSize } from '@tauri-apps/api/webview';
408- * await getCurrent ().setSize(new LogicalSize(600, 500));
408+ * await getCurrentWebview ().setSize(new LogicalSize(600, 500));
409409 * ```
410410 *
411411 * @param size The logical or physical size.
@@ -435,7 +435,7 @@ class Webview {
435435 * @example
436436 * ```typescript
437437 * import { getCurrent, LogicalPosition } from '@tauri-apps/api/webview';
438- * await getCurrent ().setPosition(new LogicalPosition(600, 500));
438+ * await getCurrentWebview ().setPosition(new LogicalPosition(600, 500));
439439 * ```
440440 *
441441 * @param position The new position, in logical or physical pixels.
@@ -469,8 +469,8 @@ class Webview {
469469 * Bring the webview to front and focus.
470470 * @example
471471 * ```typescript
472- * import { getCurrent } from '@tauri-apps/api/webview';
473- * await getCurrent ().setFocus();
472+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
473+ * await getCurrentWebview ().setFocus();
474474 * ```
475475 *
476476 * @returns A promise indicating the success or failure of the operation.
@@ -485,8 +485,8 @@ class Webview {
485485 * Set webview zoom level.
486486 * @example
487487 * ```typescript
488- * import { getCurrent } from '@tauri-apps/api/webview';
489- * await getCurrent ().setZoom(1.5);
488+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
489+ * await getCurrentWebview ().setZoom(1.5);
490490 * ```
491491 *
492492 * @returns A promise indicating the success or failure of the operation.
@@ -502,8 +502,8 @@ class Webview {
502502 * Moves this webview to the given label.
503503 * @example
504504 * ```typescript
505- * import { getCurrent } from '@tauri-apps/api/webview';
506- * await getCurrent ().reparent('other-window');
505+ * import { getCurrentWebview } from '@tauri-apps/api/webview';
506+ * await getCurrentWebview ().reparent('other-window');
507507 * ```
508508 *
509509 * @returns A promise indicating the success or failure of the operation.
@@ -525,7 +525,7 @@ class Webview {
525525 * @example
526526 * ```typescript
527527 * import { getCurrent } from "@tauri-apps/api/webview";
528- * const unlisten = await getCurrent ().onDragDropEvent((event) => {
528+ * const unlisten = await getCurrentWebview ().onDragDropEvent((event) => {
529529 * if (event.payload.type === 'hover') {
530530 * console.log('User hovering', event.payload.paths);
531531 * } else if (event.payload.type === 'drop') {
@@ -680,6 +680,6 @@ interface WebviewOptions {
680680 zoomHotkeysEnabled ?: boolean
681681}
682682
683- export { Webview , getCurrent , getAll }
683+ export { Webview , getCurrentWebview , getAllWebviews }
684684
685685export type { DragDropEvent , DragDropPayload , WebviewOptions }
0 commit comments