メインコンテンツまでスキップ

isWebviewSourceInfoUrl

WebviewSourceInfo が URL ソースかどうかを確認する型ガードです。

function isWebviewSourceInfoUrl(source: WebviewSourceInfo): source is WebviewSourceInfoUrl

パラメータ

パラメータ説明
sourceWebviewSourceInfo確認するソース情報

戻り値

source.type === "url" の場合に true を返し、型を WebviewSourceInfoUrl に絞り込みます。

const info = await webview.info();

if (isWebviewSourceInfoUrl(info.source)) {
console.log(info.source.url);
}