MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / loadUrl

Method loadUrl

frontend/app/view/webview/webview.tsx:431–445  ·  view source on GitHub ↗

* Load a new URL in the webview. * @param newUrl The new URL to load in the webview.

(newUrl: string, reason: string)

Source from the content-addressed store, hash-verified

429 * @param newUrl The new URL to load in the webview.
430 */
431 loadUrl(newUrl: string, reason: string) {
432 const defaultSearchAtom = this.env.getSettingsKeyAtom("web:defaultsearch");
433 const searchTemplate = globalStore.get(defaultSearchAtom);
434 const nextUrl = this.ensureUrlScheme(newUrl, searchTemplate);
435 console.log("webview loadUrl", reason, nextUrl, "cur=", this.webviewRef.current.getURL());
436 if (!this.webviewRef.current) {
437 return;
438 }
439 if (this.webviewRef.current.getURL() != nextUrl) {
440 fireAndForget(() => this.webviewRef.current.loadURL(nextUrl));
441 }
442 if (newUrl != nextUrl) {
443 globalStore.set(this.url, nextUrl);
444 }
445 }
446
447 /**
448 * Load a new URL in the webview and return a promise.

Callers 3

handleHomeMethod · 0.95
handleKeyDownMethod · 0.95
webview.tsxFile · 0.80

Calls 4

ensureUrlSchemeMethod · 0.95
fireAndForgetFunction · 0.90
getMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected