mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Add destroy method
Which revokes all blob URLs and removes the element from document.
This commit is contained in:
@@ -842,6 +842,10 @@ class MOBI6 {
|
||||
isExternal(uri) {
|
||||
return /^(?!blob|filepos)\w+:/i.test(uri)
|
||||
}
|
||||
destroy() {
|
||||
for (const url of this.#resourceCache.values()) URL.revokeObjectURL(url)
|
||||
for (const url of this.#cache.values()) URL.revokeObjectURL(url)
|
||||
}
|
||||
}
|
||||
|
||||
// handlers for `kindle:` uris
|
||||
@@ -1154,4 +1158,7 @@ class KF8 {
|
||||
isExternal(uri) {
|
||||
return /^(?!blob|kindle)\w+:/i.test(uri)
|
||||
}
|
||||
destroy() {
|
||||
for (const url of this.#cache.values()) URL.revokeObjectURL(url)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user