These are chat archives for js-data/js-data

22nd
Jun 2015
Marian Ondrasak
@ondrasak
Jun 22 2015 10:38
@/all is there way how to define endpoint of resource with params ?
example: 'events/:eventId/presentation'
(Unfortunately is not possible to define relations of resouce)
Rick Carlino
@RickCarlino
Jun 22 2015 12:45
Do lifecycle hooks need to return a particular value?
Or is the return value discard / not used for anything? Just added lifecycle hooks to one of my resources for the first time and it seems to have issues updating the DOM thereafter.
Rick Carlino
@RickCarlino
Jun 22 2015 13:00
D'oh! Didn't see the part of the docs about how to call that third function to continue lifecycle. Sorry!
Jason Dobry
@jmdobry
Jun 22 2015 14:07
@ondrasak Is it an "event" resource? If so you can create some actions for it to do this
Daniel Davey
@jeriko
Jun 22 2015 19:23
Hey guys, I'm using a rest backend, any advice on dealing with unpersisted objects? i.e my server generates IDs, how do I instantiate a resource instance so it can be modified before create?
seems the whole lib is based around using IDs but the client doesn't get to choose the ID of the object they are busy creating..
Rai Butera
@Raigasm
Jun 22 2015 19:35
@jeriko not at all
look @ createInstance
You can create instances, they just can't be injected into the store unless they have some kind of primary key
Daniel Davey
@jeriko
Jun 22 2015 21:19
ah, thanks. i misunderstood create to include adapter persistence
Pascal DeMilly
@pdemilly
Jun 22 2015 21:25
In firebase endpoint defines entity. When using js-data I would like to define new resource at will so that I can watch for changes in my controller but when I am done I want to free that resource. For example let say I have a comment collection whose endpoint is some ids from an other object type. Let say I am interested in comments made on an object id 4546ads45dfd5 my end point is comments/4546ads45dfd5. Using your prior example I am able to create a new resource and watch for changes and bind it to my scope, but how can I remove that resource when I am done with my scope? Is there a removeResource method?
Jason Dobry
@jmdobry
Jun 22 2015 22:41
There isn't
Why do you need to define a new Resource on the fly? Did you see my example of doing the binding in the controller, then removing it when the controller dies?
Bryan Morris
@internalfx
Jun 22 2015 22:42
@jmdobry I noticed that js-data uses object.observe. Is there a way to get notified (callback?) of changes in js data resources?
Pascal DeMilly
@pdemilly
Jun 22 2015 23:23
@jmdobry But I don't want to listem to all "comment" changes, just the one that of the object I am currently looking at. Let say I have thousands of entity, each could have many comments. When I look at one entity then I want to listen to all comments change on that entity, but as soon as I am done, I will stop listening until next time. At that point I will do a refresh, bind to only the comments I need. I have it working, but I am always wondering the impact on memory in the long run.
Jason Dobry
@jmdobry
Jun 22 2015 23:49
@internalfx Coming in 2.x. Right now you're limited to hooking into beforeInject and afterInject
Bryan Morris
@internalfx
Jun 22 2015 23:49
@jmdobry well....it is an "exprimental" project I'm working on...Is 2.x beta usable?
Jason Dobry
@jmdobry
Jun 22 2015 23:50
@pdemilly Unfortunately, Firebase has really poor collection querying capabilities.
@internalfx Oh yes, just pay attention to the breaking changes listed in the changelog