enable gc in demo

This commit is contained in:
Kevin Jahns 2018-05-23 16:15:11 +02:00
parent c122bdc750
commit 9be256231b
2 changed files with 4 additions and 4 deletions

View File

@ -3,10 +3,10 @@ import YWebsocketsConnector from '../../src/Connectors/WebsocketsConnector/Webso
import Y from '../../src/Y.mjs' import Y from '../../src/Y.mjs'
import DomBinding from '../../src/Bindings/DomBinding/DomBinding.mjs' import DomBinding from '../../src/Bindings/DomBinding/DomBinding.mjs'
import UndoManager from '../../src/Util/UndoManager.mjs' import UndoManager from '../../src/Util/UndoManager.mjs'
import XmlFragment from '../../src/Types/YXml/YXmlFragment.mjs' import YXmlFragment from '../../src/Types/YXml/YXmlFragment.mjs'
const connector = new YWebsocketsConnector() const connector = new YWebsocketsConnector()
const y = new Y('html-editor') const y = new Y('html-editor', null, null, { gc: true })
connector.connectY('html-editor', y) connector.connectY('html-editor', y)
window.onload = function () { window.onload = function () {
@ -14,7 +14,7 @@ window.onload = function () {
} }
window.y = y window.y = y
window.yXmlType = y.define('xml', XmlFragment) window.yXmlType = y.define('xml', YXmlFragment)
window.undoManager = new UndoManager(window.yXmlType, { window.undoManager = new UndoManager(window.yXmlType, {
captureTimeout: 500 captureTimeout: 500
}) })

View File

@ -48,7 +48,7 @@ const wsConnector = {
getRoom: function getRoom (roomName) { getRoom: function getRoom (roomName) {
let room = rooms.get(roomName) let room = rooms.get(roomName)
if (room === undefined) { if (room === undefined) {
const y = new Y(roomName) const y = new Y(roomName, null, null, { gc: true })
y.on('afterTransaction', (y, transaction) => { y.on('afterTransaction', (y, transaction) => {
if (transaction.encodedStructsLen > 0) { if (transaction.encodedStructsLen > 0) {
const encoder = new BinaryEncoder() const encoder = new BinaryEncoder()