y-js / y-map Goto Github PK
View Code? Open in Web Editor NEWMap type for Yjs
Home Page: http://y-js.org
License: MIT License
Map type for Yjs
Home Page: http://y-js.org
License: MIT License
I'm doing y.share.map.set('one',{two:'three',four:'five'})
, which works ok.
How could I y.share.map.get('one.two')?
or even y.share.map.set('one.two','six')
? (these do not work)
https://github.com/y-js/y-map/blob/master/src/Map.js#L22
Seems to be the same issue as in
yjs/yjs#46
Hi @dmonad,
Came across this while checking out the source code. I guess this is a simple copy paste error. Same issue is also present in y-array. But I am not opening another issue there.
Thanks for your hard work on this awesome library!
When using websockets, after a reconnect the deleted nodes are still shown as entries when calling .keys().
Reproduce:
Solution: Probably just check if ops are deleted before putting them in .opContents/.contents.
Hi all,
Can we apply multiple deletions in one operation ?
If I understand the library right, when we make want to make a change, we broadcast this change to other peers and they will resolve the conflicts. If we can support this, we can send multiple ops in one message, this will give better performance.
Thanks.
It seems that the last published version (10.1.3) doesn't contain the toJSON method
When using IPFS I want to unsubscribe the topic and .delete(key) locally. Not delete the key across the network.
How do I Achieve this?
In my y-map array observer, let's call it observeMap(event)
, when calling event.object.get(event.name).then(function(map)) {...}
, the value of map
is undefined in the newest release. ๐ข
Data set by User 1 whilst connected to YJS is received by User 2 in order of being set, whereas data set whilst User 1 isn't connected, then a connection is re-established is received by User 2 in reverse order
User 2 Observation when User 1 sets whilst connected
User 2 Observation when User 1 sets whilst offline, then reconnects
I'm looking to keep a JSON array synchronized across clients using YJS and y-map fits the bill. However, in my application I would would prefer to keep the array type which the client directly manipulates and reads from as JSON since it is easier to plug in to other libraries.
From my understanding currently there is no way to 'synchronize' the y-map with a JSON array, is that correct? If so would something that does that be in the scope of this data type (i.e. a serialize/deserialize) or would a separate library be a better place?
When getting a store that doesn't exist, the promise throws a console error.
Being told why the error occurred may be useful as it will help with scenarios such as if doesn't exist, create
.
The event fired when you add a new key to a YMap has a value key when you add a primitive value, but has undefined
value when you add a Y type. Here are two tests to illustrate. The first one passes and the second one fails. I'm not sure what the intended behaviour is, but maybe this is an issue which is easily fixed (In the event handler, I just do event.value = event.object.get(event.name)
.
There's also a similar issue in YArray.toArray() where Y primitives appear as expected, but Y types show as undefined.
it('event has correct value when setting a primitive on a YMap', async(function * (done) {
var event
yield flushAll()
y1.observe(function (e) {
event = e // just put it on event, should be thrown synchronously anyway
})
yield y1.set('stuff', 2)
expect(event.value).toEqual(event.object.get(event.name))
// delete
y1.delete('stuff')
done()
}))
it('event has correct value when setting a type on a YMap', async(function * (done) {
var event
yield flushAll()
y1.observe(function (e) {
event = e // just put it on event, should be thrown synchronously anyway
})
yield y1.set('stuff', Y.Map)
expect(event.value).toEqual(event.object.get(event.name))
// delete
y1.delete('stuff')
done()
}))
๐
Look here:
https://github.com/y-js/y-map/blob/master/src/Map.js#L140
Hey, thanks for the great work! However, I cannot find in your documentation how the event looks like that the observer gets. E.g., it was hard work to figure out that I can get the value by event.object.get(event.name, ...). And after implementing it like this, I found it out the hard way that it also works with event.value. ๐
First off, thanks for making and maintaining this project, it seems great!
Given the following:
const Y = require('yjs')
newDoc = new Y.Doc()
doc = newDoc.getMap('patches')
doc.set('patch',
{"people":
{"michael":
{ "lastname": "smith",
"height": "tall"
},
"sal":
{ "lastname": "orange",
"height": "small"
}
}
})
In vanilla js, to dynamically update a property I could do:
let name = 'sal'
let prop = 'height'
people[name][height] = 'short'
How would I do this same operation in Yjs? I know that issue #11is similar, but does not discuss dealing with nested and dynamic properties.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.