These are chat archives for canjs/canjs

5th
Jan 2017
Thomas Sieverding
@Bajix
Jan 05 2017 10:07
Is there a way to bypass Steal’s bundling? This build bug’s blocking my release
Nico R.
@nriesco
Jan 05 2017 11:09
@cherifGsoul I haven’t been able to make the promise/then/notPromise work. I would like to try something that @phillipskevin suggested in the past in gitter (canjs or donejs, I spend hours trying to search for it but couldn’t find it) that uses resolve the code was something like this:
export const ViewModel = Map.extend({
  define: {
    storyPromise: {
      get: function() {
        return Story.getList();
      }
    },
    storyValue: {
      get: function() {
        // this code probably is not valid 
        return this.storyPromise.resolve(function(resolve, lastValue) {
          resolve(lastValue);
        });
      }
    },
  }
});
As you might realize I have no experience with promises
Thomas Sieverding
@Bajix
Jan 05 2017 11:12
@nriesco resolve should only ever be lexically available within the promise resolve/reject callback
You can do {{#storyPromise.value}} within stache
Also streams have flatMap which can be combined w/ Kefir.fromPromise to express that
Nico R.
@nriesco
Jan 05 2017 11:31
@Bajix I already do (and works) {{#storyPromise.isResolved}} and {{#storyPromise.value}} within the .stache file the problem is that I want to iterate over those values, that didn’t work for me. I found a way and it worked but it won’t update (for instance the total number of elements) even if the elements change
Thomas Sieverding
@Bajix
Jan 05 2017 11:32
{{#each storyPromise.value}} works
Nico R.
@nriesco
Jan 05 2017 11:32
yes
but I need to do that in the viewmodel
Thomas Sieverding
@Bajix
Jan 05 2017 11:32
Then you should use streams
Nico R.
@nriesco
Jan 05 2017 11:33
could you send me any reference regarding streams (in canjs 2.x) I’ll try to learn to use them this week then
Thomas Sieverding
@Bajix
Jan 05 2017 11:33
It’s 3.x only
Kevin Phillips
@phillipskevin
Jan 05 2017 13:00
normally when we do stuff like that the storyValue getter is something like this.storyPromise.then(resolve);
Matthew Phillips
@matthewp
Jan 05 2017 13:19
@Bajix which build bug?
Justin Meyer
@justinbmeyer
Jan 05 2017 16:08
I just did a quick training on DefineMap: https://www.youtube.com/watch?v=eXp3m-ZlL4Y