These are chat archives for canjs/canjs

22nd
Oct 2018
Mohamed Cherif Bouchelaghem
@cherifGsoul
Oct 22 2018 07:12
@pYr0x for multiple promises I used to use Promise.all https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
inside a getter as suggested by @jeroencornelissen
Julian
@pYr0x
Oct 22 2018 07:41
@jeroencornelissen @cherifGsoul @Lighttree thx for ideas.
.isResolved is not available in pure Javascript?
Frank Lemanschik
@frank-dspeed
Oct 22 2018 07:56
No!
A promise has .status
Promise {<resolved>: ""}
proto: Promise
catch: ƒ catch()
constructor: ƒ Promise()
finally: ƒ finally()
then: ƒ then()
Symbol(Symbol.toStringTag): "Promise"
proto: Object
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: ""
Kevin Phillips
@phillipskevin
Oct 22 2018 17:36
@pYr0x, @justinbmeyer did add an {{# and(...) }} helper in stache 4.15.0
docs are still in progress though
Julian
@pYr0x
Oct 22 2018 18:12
@phillipskevin very nice!
Jeroen Cornelissen
@jeroencornelissen
Oct 22 2018 19:46
👍👌
Julian
@pYr0x
Oct 22 2018 20:28
there a an event thats gets triggered if a can-connect model changed its content
like
<tr>
                    <th scope="row">Bemerkung</th>
                    <td><input type="text" class="form-control" value:bind="probeDetails.bemerkung"></td>
                </tr>
if the value change, the model show call .save()
Kevin Phillips
@phillipskevin
Oct 22 2018 20:29
you want an event when probeDetails.bemerkung changes?
Julian
@pYr0x
Oct 22 2018 20:29
yes
i can add an event on the input, but if have 100 inputs ;)
Kevin Phillips
@phillipskevin
Oct 22 2018 20:30
on:bemerkung:by:probeDetails="save()"
oh
you want to listen to any time a property on probeDetails changes?
Julian
@pYr0x
Oct 22 2018 20:30
is there not way with .listenTo
yes
Kevin Phillips
@phillipskevin
Oct 22 2018 20:31
you can do probeDetails.onPatches(() => { ... });
Julian
@pYr0x
Oct 22 2018 20:31
ok
i will try that
thx kevin
Kevin Phillips
@phillipskevin
Oct 22 2018 20:31
I'm not sure if there's a way with listenTo
Julian
@pYr0x
Oct 22 2018 20:32
do you had ever a request for a model that autosave while typing?
Kevin Phillips
@phillipskevin
Oct 22 2018 20:33
yeah
Julian
@pYr0x
Oct 22 2018 20:34
do you listen on property changes? or how do you solve it
Kevin Phillips
@phillipskevin
Oct 22 2018 20:36
I think when we did this, we used an Observation to wrap the serialized value
Julian
@pYr0x
Oct 22 2018 20:36
oh ok
Kevin Phillips
@phillipskevin
Oct 22 2018 20:37
const serialized = Observation(() => list.serialize());
Reflect.onValue(serialized, () => { // save() });
Julian
@pYr0x
Oct 22 2018 20:38
ok.. i have now some ideas... i will try those ... thanks
Kevin Phillips
@phillipskevin
Oct 22 2018 20:38
sure
good luck