@snippetify/book-reader
Version:
Book reader utilities
19 lines (15 loc) • 479 B
JavaScript
class Selection {
constructor (data) {
this.content = data.content
this.pages = data.pages || []
this.serialized = data.serialized
this.references = data.references || [] // Paragraph positions in page start from 1
}
isOnSinglePage () {
return this.pages.length === 1 || this.pages[0] === this.pages[1]
}
isOnSingleELement () {
return this.references.length === 1 || this.references[0] === this.references[1]
}
}
module.exports = Selection