soocrate-core
Version:
this is the core of soocrate application
34 lines (30 loc) • 875 B
JavaScript
import { MarkerEvent } from './MarkerEvent'
var debug = require('debug')('CRATE:Communication:MarkerManager:CaretManger')
export class CaretManager extends MarkerEvent {
constructor(opts) {
const EventName = opts.EventName || 'Caret'
super({ EventName, ...opts })
this._defaultOptions = {
lifeTime: 5 * 1000,
cursor: true
}
}
/**
* [caretMoved description]
* @param {[type]} range [description]
* @return {[type]} [description]
*/
caretMoved(range) {
this.broadcast({ range, id: this._document.uid })
return range
}
/**
* At the reception of CARET position
* @param {[type]} range [description]
* @param {[type]} id [description]
* @return {[type]} [description]
*/
receive({ range, id }) {
this.emit('Caret_received', { range, id })
}
}