If you run this code in a browser
const sharedDoc = new Y.Doc()
const sharedArray = sharedDoc.getArray('sharedArray')
sharedArray.insert(0,[
null, true, 1.23, 'Test', [ null,true,1.23,'Test' ],
{ 'null':null, 'boolean':true, number:1.23, 'string':'Test' },
new Uint8Array([1,2,3,4]), new Y.Map(), new Y.Array(), new Y.Text(),
new Y.XmlElement(), new Y.XmlFragment(), new Y.XmlText(),
new Y.Doc()
])
console.log('sharedDoc',sharedDoc)
and then inspect sharedDoc.share[1].value._start.content.arr
within your browser’s console, you will see only the first 6 elements - the new Y.Map()
and the following are missing
Running a similar code for a Y.Map
const sharedDoc = new Y.Doc()
const sharedMap = sharedDoc.getMap('sharedMap')
sharedMap.set('null', null)
sharedMap.set('boolean', true)
sharedMap.set('number', 1.23)
sharedMap.set('string', 'Test')
sharedMap.set('tuple', [ null,true,1.23,'Test' ])
sharedMap.set('struct', { 'null':null, 'boolean':true, number:1.23, 'string':'Test' })
sharedMap.set('binary', new Uint8Array([1,2,3,4]))
sharedMap.set('map', new Y.Map())
sharedMap.set('array', new Y.Array())
sharedMap.set('text', new Y.Text())
sharedMap.set('xml-element', new Y.XmlElement())
sharedMap.set('xml-fragment',new Y.XmlFragment())
sharedMap.set('xml-text', new Y.XmlText())
sharedMap.set('doc', new Y.Doc())
console.log('sharedDoc',sharedDoc)
will list all entries instead.
Is this really the intended behaviour?