These are chat archives for canjs/canjs

6th
Sep 2018
Viktor Busko
@Lighttree
Sep 06 2018 08:05

seems to work correctly if you ObservationRecorder.ignore the helper function: https://codepen.io/kphillips86/pen/rZzmbj?editors=0010
(Observation.ignore in 3.x)

@phillipskevin I'll check later today. I didn't added this Observation.ignore before. To be honest I had no idea about this thing.

Viktor Busko
@Lighttree
Sep 06 2018 13:54
Hmmm... but even in your codepen initial value not changes to new value, so it looks like it doesn't work.
Kevin Phillips
@phillipskevin
Sep 06 2018 14:10
hmm, it did... let me check
Viktor Busko
@Lighttree
Sep 06 2018 14:54
hah I was thinking about definemaps but looks like overkill :D
but works )
Kevin Phillips
@phillipskevin
Sep 06 2018 14:54
it actually doesn't work...
it still gets stringified for attributes
Viktor Busko
@Lighttree
Sep 06 2018 14:54
ah in attribute I see
Kevin Phillips
@phillipskevin
Sep 06 2018 14:55
this shouldn't be this hard...
Viktor Busko
@Lighttree
Sep 06 2018 14:55
yep )
Kevin Phillips
@phillipskevin
Sep 06 2018 15:57
@Lighttree would it be possible to set up the attributes a different way?
Kevin Phillips
@phillipskevin
Sep 06 2018 16:04
this works ok:
viewCallbacks.attr("async-attr", el => {
    const attr = el.getAttribute("async-attr");
    const text = new SimpleObservable("initial value");

    setTimeout(() => {
        console.log("changing attribute");
        text.set("new value");
    }, 1000);

    viewLive.attr(el, attr, text);
});

Component.extend({
    tag: "test-sandbox",
    view: `
    <p async-attr="alt">{{ asyncText() }}</p>
  `
});
obviously it would be nicer if your helper could just return an observable
Kevin Phillips
@phillipskevin
Sep 06 2018 16:18
I opened an issue @Lighttree: canjs/can-stache#585