These are chat archives for canjs/canjs

22nd
May 2015
Patrick Clancy
@patrickclancy
May 22 2015 13:48
I’m looking at the place-my-order repo. Is this model tag supported in canjs 2.3-pre? If so where can I find the docs?
<order-model findAll="{status='preparing'}”>
...
</order-model>
Matthew Phillips
@matthewp
May 22 2015 15:27
that's part of can-connect @patrickclancy
i'm not sure if it works with the current -pre or not
we have a non-passing branch with a bunch of new stuff that will be the next pre
oh, and the model tag is not in can-connect master branch yet either
so yeah, we have a little more work to do
but soon :)
Patrick Clancy
@patrickclancy
May 22 2015 15:35
@matthewp O.K. can-connect looks fantastic. I’ll need to look deeper into it.
Matthew Phillips
@matthewp
May 22 2015 15:38
yeah it's pretty amazing
Curtis Cummings
@ccummings
May 22 2015 18:17
@alexisabril I knew it was the updated method doing it but was hoping there was a way to avoid rewriting that method completely. Thanks for the help!
Chris Gomez
@akagomez
May 22 2015 18:33
I want to build a small utility that makes evaluating the current batchNum easier. Is that something that would be a good addition to can.batch?
Matthew Phillips
@matthewp
May 22 2015 18:34
what does the utility do?
Chris Gomez
@akagomez
May 22 2015 18:35
if (ev.batchNum) {
  if (ev.batchNum === this._lastProcessedBatchNum) {
    return; 
  } else {
    this._lastProcessedBatchNum = ev.batchNum;
  }
}
So it’d be something like…
can.batch.hasBeenCalledAlready(‘task’, ev.batchNum)
Curtis Cummings
@ccummings
May 22 2015 18:37
@akagomez +1. This is a pattern I’ve had to use quite often
Chris Gomez
@akagomez
May 22 2015 18:38
I’m open to ideas about the call signature, but I think it’s something that could be abstracted.
Curtis Cummings
@ccummings
May 22 2015 18:38
Way back when batch was first proposed I thought there was talk of a changed event that fired once per batch. Then you don’t have to deal with the batchNums. It would fire once per batch and when there is no batchNum
Chris Gomez
@akagomez
May 22 2015 18:39
I remember @justinbmeyer mentioning that too.
So changed would fire for ANY event that was batched?
Curtis Cummings
@ccummings
May 22 2015 18:43
Not sure if the name makes sense now with batch being available to any event.
Chris Gomez
@akagomez
May 22 2015 18:43
But it wouldn’t silence the original event, so you’d still need to put logic in your add, length, etc handler to NOT do things that the changed handler was already handling.
Or maybe…
list.bind(‘length’, can.batch.debounce(function (ev) {
  // Only run when ev.batchNum === undefined || ev.batchNum !== this._lastBatchNum
})
Matthew Phillips
@matthewp
May 22 2015 18:47
unrelated to this, I'm working on figuring out some of the issues we have with our binding syntax
Chris Gomez
@akagomez
May 22 2015 18:47
(Whoops! Missed a closing parenthesis there)
@matthewp I’d need to read that 20 more times to have anything meaningful to say.
Chris Gomez
@akagomez
May 22 2015 18:52
@ccummings What do you think about can.batch.debounce? I’m starting to dig it the more I think about it.
It kind of makes me curious why we don’t do that for all event handlers internally. I’m probably missing something.
Matthew Phillips
@matthewp
May 22 2015 18:57
i like that
Chris Gomez
@akagomez
May 22 2015 19:08
@matthewp can.batch.debounce and/or debouncing all event handlers internally?
Matthew Phillips
@matthewp
May 22 2015 19:31
we couldn't debounce them all because of compat
i do like can.batch.debounce though
Chris Gomez
@akagomez
May 22 2015 19:39
@matthewp Cool. I’ll suggest it in an issue then. See if anybody else digs it.
Chris Gomez
@akagomez
May 22 2015 20:34
@matthewp @ccummings bitovi/canjs#1708