Skip to content

Commit af388c5

Browse files
committed
chore: 增加脚本
1 parent bd42c1c commit af388c5

3 files changed

Lines changed: 1807 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { snapdom } from './lib/snapdom.min.mjs'
2+
3+
export async function getUrl(selector, options = {}) {
4+
let data = null;
5+
const el = document.querySelector(selector);
6+
if (el) {
7+
options.embedFonts = true;
8+
const result = await snapdom(el, options);
9+
data = result.url;
10+
}
11+
return data;
12+
}
13+
14+
export async function getStream(selector, options = {}) {
15+
let data = null;
16+
const el = document.querySelector(selector);
17+
if (el) {
18+
options.embedFonts = true;
19+
const result = await snapdom(el, options);
20+
data = result.toBlob();
21+
}
22+
return data;
23+
}

0 commit comments

Comments
 (0)