big documentation update - all public functions and classes are documented now

This commit is contained in:
Kevin Jahns
2018-03-05 03:03:40 +01:00
parent dc22a79ac4
commit a9b610479d
33 changed files with 2426 additions and 168 deletions

View File

@@ -64,7 +64,15 @@ function applyReverseOperation (y, scope, reverseBuffer) {
return performedUndo
}
/**
* Saves a history of locally applied operations. The UndoManager handles the
* undoing and redoing of locally created changes.
*/
export default class UndoManager {
/**
* @param {YType} scope The scope on which to listen for changes.
* @param {Object} options Optionally provided configuration.
*/
constructor (scope, options = {}) {
this.options = options
options.captureTimeout = options.captureTimeout == null ? 500 : options.captureTimeout
@@ -101,12 +109,20 @@ export default class UndoManager {
}
})
}
/**
* Undo the last locally created change.
*/
undo () {
this._undoing = true
const performedUndo = applyReverseOperation(this.y, this._scope, this._undoBuffer)
this._undoing = false
return performedUndo
}
/**
* Redo the last locally created change.
*/
redo () {
this._redoing = true
const performedRedo = applyReverseOperation(this.y, this._scope, this._redoBuffer)