These are chat archives for canjs/canjs

15th
Sep 2017
Kevin Phillips
@phillipskevin
Sep 15 2017 00:35
can-kefir streams can be used directly in stache
the properties that derive from other properties have to be outside the object
so that they can reference viewModel
Frank Lemanschik
@frank-dspeed
Sep 15 2017 06:43
i don't understand that :(
but ok thanks for explaining then it looked better then i tought
still was interristing to see how others handle streams
Justin Meyer
@justinbmeyer
Sep 15 2017 13:36
Huh?
sorry, I'm not sure what is being asked
All that was being used is can-kefir and can-stache
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:37
its already solved by kevin
Justin Meyer
@justinbmeyer
Sep 15 2017 13:37
can-kefir decorates Kefir streams so can-stache can observe them like we do promises
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:37
i saw in the video only original kefir and no can-kefir
yes i understand i was confused because of the plain object where you assigned the streams
Justin Meyer
@justinbmeyer
Sep 15 2017 13:38

native supported like promises for stache templates without that stream

Yes, promises and kefir streams now work the same way

Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:39
can-kefir streams work the same way?
or really kefir streams?
do i need the can-kefir only for the emitter property?
Justin Meyer
@justinbmeyer
Sep 15 2017 13:39
can-kefir directly decorates Kefir streams
no, you need can-kefir to decorate Kefir streams
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:39
and only the decorated once work directly with can-stache
right?
yes, but they should all be decorated
b/c we change the Kefir object's prototype
this is just like we do with Promise
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:41
oh about promises good that your there
if i have lets say a promise as value property of define wich is a standart thing
is it right that i update that best via a getter that uses the existing value does .then(setVal)
?
or should i simply return Promise.resolve() in the getter? to update the value so that can-stache observes it
Justin Meyer
@justinbmeyer
Sep 15 2017 13:43
why are you updating the promise? Do you have a bit of example code to make what you're saying a bit more clear?
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:44
i am updating a promise because of async events that happen
the first event is a promise so i think i should not convert that
lets say Model.getData({})
Justin Meyer
@justinbmeyer
Sep 15 2017 13:45
one can't update a promise ... I think you mean update a property whose value is a promise
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:45
yes without braking the bindings
Justin Meyer
@justinbmeyer
Sep 15 2017 13:45
once promises resolve, you can't resolve them again
this has nothing to do w/ bindings
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:46
yes but i can reuse them and then return a other value and set that
the promise don't loses its old resolve value
OldPromise = OldPromise.then((val)=>newVal)
that makes OldPromise resolve to a new value
ok maybe this is a to stupid question i got your point promises are promises :)
Justin Meyer
@justinbmeyer
Sep 15 2017 13:48
yeah, you can have the value be a new promise
and the bindings should work
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:49
yes that example worked but i was wondering if thats the right way
Justin Meyer
@justinbmeyer
Sep 15 2017 13:49
now, for how to make the value be a new promise, you have the same options you would any other property value
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:49
but maybe you can help me with something other because your the algebra guru
i have a case where i want to merge 2 define lists
1x comes from a normal model and has its Model Type this way
Justin Meyer
@justinbmeyer
Sep 15 2017 13:50
  1. Do it imperatively somewhere else.
  2. Do it declaratively/functionally with a getter
  3. Do it declaratively/functionally with can-define-stream-kefir
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:50
when i create now a new list lets say out of localstorage via the same Model
so every prop from storage has same type
and i push them to the existing list from the getList() function
i get information that the data don't matches my inital find request so the getList request
:)
i hope that makes sense
i do a getList({ status: true })
and push into that some with status: false
what is doing that matching?
Justin Meyer
@justinbmeyer
Sep 15 2017 13:52
I'm not sure what you're asking. Can you write this up in a forum post? I promise that @chasenlehara or I will look at it. I've got to start the day now.
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:53
ah ok ya i will do that :)
start the day sounds amazing
Justin Meyer
@justinbmeyer
Sep 15 2017 13:53
(generally speaking, you shouldn't have to push to a list retrieved via .getList() as the algebra should add things automatically)
Frank Lemanschik
@frank-dspeed
Sep 15 2017 13:53
like the day wouldn't start without you :)
no i need to merge data from db
and local
but maybe i need to add a extra behavier for that
i retrive the list with full filled modells and need to merge with retrived models from a id array
Chasen Le Hara
@chasenlehara
Sep 15 2017 15:32
Watch our LIVE contributors meeting in just a few minutes where we’ll talk about what the core team is working on! https://www.youtube.com/watch?v=Z_cLpLfFooA