You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to pass a reference around, and create a reference to a child cursor at a later stage, where I might not have access to the entire structure:
The new reference API actually support passing in a cursor. See https://github.com/omniscientjs/immstruct/blob/master/src/structure.js#L206. This is not documented yet, as it is unreleased. Will hopefully be released within the month. We could also extend the API allow for references to create references, something like the code below.
Structure.prototype.reference=functionreference(path){// local function name to avoid collisions// ...varself=this,cursor=this.cursor(path),unobservers=Immutable.Set();// ...return{reference: function(subPath){returnreference((cursor._keyPath||[]).concat(subPath));},observe: function(eventName,newFn){},cursor: function(subPath){},// ... etc
Note: This is untested, but something like it should work. Pull Requests with tests and docs are very welcome! 🍰
I want to be able to pass a reference around, and create a reference to a child cursor at a later stage, where I might not have access to the entire structure:
Any thoughts on how to accomplish this? Or, how to get a reference by passing a cursor to the structure, perhaps?
The text was updated successfully, but these errors were encountered: