Add: Experimental bookmarks edit and delete #115

This commit is contained in:
advplyr 2021-10-26 20:09:04 -05:00
parent fffa02e7e8
commit 9f66054a72
10 changed files with 234 additions and 39 deletions

View file

@ -107,11 +107,26 @@ class AudiobookProgress {
return hasUpdates
}
checkBookmarkExists(time) {
return this.bookmarks.find(bm => bm.time === time)
}
createBookmark(time, title) {
var newBookmark = new AudioBookmark()
newBookmark.setData(time, title)
this.bookmarks.push(newBookmark)
return newBookmark
}
updateBookmark(time, title) {
var bookmark = this.bookmarks.find(bm => bm.time === time)
if (!bookmark) return false
bookmark.title = title
return bookmark
}
deleteBookmark(time) {
this.bookmarks = this.bookmarks.filter(bm => bm.time !== time)
}
}
module.exports = AudiobookProgress