MCPcopy Create free account
hub / github.com/pacexy/flow / attach

Method attach

packages/epubjs/src/annotations.js:235–250  ·  view source on GitHub ↗

* Add to a view * @param {View} view

(view)

Source from the content-addressed store, hash-verified

233 * @param {View} view
234 */
235 attach(view) {
236 let { cfiRange, data, type, mark, cb, className, styles } = this
237 let result
238
239 if (type === 'highlight') {
240 result = view.highlight(cfiRange, data, cb, className, styles)
241 } else if (type === 'underline') {
242 result = view.underline(cfiRange, data, cb, className, styles)
243 } else if (type === 'mark') {
244 result = view.mark(cfiRange, data, cb)
245 }
246
247 this.mark = result
248 this.emit(EVENTS.ANNOTATION.ATTACH, result)
249 return result
250 }
251
252 /**
253 * Remove from a view

Callers 2

addMethod · 0.95
injectMethod · 0.80

Calls 3

highlightMethod · 0.45
underlineMethod · 0.45
markMethod · 0.45

Tested by

no test coverage detected