more options to gc data (undomanager.clear and tryGc)

This commit is contained in:
Kevin Jahns
2020-01-27 03:42:32 +01:00
parent 705dce7838
commit e3c59b0aa7
6 changed files with 113 additions and 63 deletions

View File

@@ -25,10 +25,12 @@ export class Doc extends Observable {
/**
* @param {Object} conf configuration
* @param {boolean} [conf.gc] Disable garbage collection (default: gc=true)
* @param {function(Item):boolean} [conf.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.
*/
constructor ({ gc = true } = {}) {
constructor ({ gc = true, gcFilter = () => true } = {}) {
super()
this.gc = gc
this.gcFilter = gcFilter
this.clientID = random.uint32()
/**
* @type {Map<string, AbstractType<YEvent>>}