feat(tracker):safe font node callback
This commit is contained in:
parent
7dbdae283d
commit
603f8c30b1
1 changed files with 18 additions and 16 deletions
|
|
@ -45,22 +45,24 @@ export default function (app: App) {
|
|||
app.observer.attachContextCallback(patchWindow)
|
||||
patchWindow(window)
|
||||
|
||||
app.nodes.attachNodeCallback((node) => {
|
||||
if (!isDocument(node)) {
|
||||
return
|
||||
}
|
||||
const ffDataArr = docFonts.get(node)
|
||||
if (!ffDataArr) {
|
||||
return
|
||||
}
|
||||
app.nodes.attachNodeCallback(
|
||||
app.safe((node) => {
|
||||
if (!isDocument(node)) {
|
||||
return
|
||||
}
|
||||
const ffDataArr = docFonts.get(node)
|
||||
if (!ffDataArr) {
|
||||
return
|
||||
}
|
||||
|
||||
const parentID = node.defaultView === window ? 0 : app.nodes.getID(node)
|
||||
if (parentID === undefined) {
|
||||
return
|
||||
}
|
||||
const parentID = node.defaultView === window ? 0 : app.nodes.getID(node)
|
||||
if (parentID === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
ffDataArr.forEach((ffData) => {
|
||||
app.send(LoadFontFace(parentID, ...ffData))
|
||||
})
|
||||
})
|
||||
ffDataArr.forEach((ffData) => {
|
||||
app.send(LoadFontFace(parentID, ...ffData))
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue