Skip to main content

isWebviewSourceInfoLocal

Type guard that checks whether a WebviewSourceInfo is a local asset source.

function isWebviewSourceInfoLocal(source: WebviewSourceInfo): source is WebviewSourceInfoLocal

Parameters

ParameterTypeDescription
sourceWebviewSourceInfoThe source info to check

Returns

true if source.type === "local", narrowing the type to WebviewSourceInfoLocal.

Example

const info = await webview.info();

if (isWebviewSourceInfoLocal(info.source)) {
console.log(info.source.id);
}