function init() {
$app.onPreUpdateEntryEvent(e => {
$store.set("onPreUpdateEntry", $clone(e))
})
}
$app.onGetAnime((e) => {
if(e.anime.id === 130003) {
console.log(e.anime.title)
// {
// "english": "Bocchi the Rock!",
// "romaji": "Bocchi the Rock!",
// "userPreferred": "Bocchi the Rock!"
// }
e.anime.title = { "english": "The One Piece is Real" }
console.log(e.anime.title)
// {
// "english": "The One Piece is Real",
// "romaji": "Bocchi the Rock!",
// "userPreferred": "Bocchi the Rock!"
// }
// ✅ Overwrite the entire 'title' object
$replace(e.anime.title, { "english": "The One Piece is Real" })
console.log(e.anime.title)
// {
// "english": "The One Piece is Real",
// "romaji": undefined,
// "userPreferred": undefined
// }
e.anime.synonyms[0] = "The One Piece" // ✅ Works
$replace(e.anime.synonyms[0], "The One Piece") // ✅ Works
// ⛔️ Doesn't work because 'id' is not a reference under the hood
$replace(e.anime.id, 22)
// ⛔️ Doesn't work if 'bannerImage' is undefined
$replace(e.anime.bannerImage, "abc")
}
e.next();
})
// Get a magnet link from a torrent file content
const res = await fetch("http://[...].torrent")
const content = res.text()
$torrentUtils.getMagnetLinkFromTorrentData(content)