Rename SvgViewer.init to render and update usage

This commit is contained in:
ema
2025-07-05 09:31:57 +08:00
parent a14b22d762
commit 007b960019
2 changed files with 10 additions and 10 deletions

View File

@@ -5,15 +5,15 @@
<title>LottieFiles Preview</title> <title>LottieFiles Preview</title>
<style> <style>
html, body { html, body {
width: 100%; width: 100%;
height:100%; height:100%;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
} }
#bm { #bm {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
</head> </head>

View File

@@ -242,10 +242,10 @@ class SvgViewer {
} }
/** /**
* Initialize SVG viewer. * Render SVG file.
* @async * @async
*/ */
async init() { async render() {
const rawSvg = await chrome.webview.hostObjects.external.GetSvgContent(); const rawSvg = await chrome.webview.hostObjects.external.GetSvgContent();
const parser = new DOMParser(); const parser = new DOMParser();
const doc = parser.parseFromString(rawSvg, 'image/svg+xml'); const doc = parser.parseFromString(rawSvg, 'image/svg+xml');
@@ -263,5 +263,5 @@ class SvgViewer {
} }
} }
// Create and initialize the SVG viewer // Create the SVG viewer and render
new SvgViewer().init(); new SvgViewer().render();