These are chat archives for canjs/canjs

15th
Jan 2017
Justin Meyer
@justinbmeyer
Jan 15 2017 00:29
@matthewp yeah, I'd consider pre dangerous to use at any phase
Nico R.
@nriesco
Jan 15 2017 02:32

I guess this is really easy, but I got stucked. I’m getting a list of elements using the classical:

   cardPromise: {
      get: function() {
        return Card.getList({ active: true });
      }
    },

The thing is that I’m sorting the “Cards” in the API server but when I change the order (order is actually a property of a Card element) the actual position of the element is not changed or re-sorted until I reload the page. I would like to add some sorting so if that value changes it will sort the Card elements again. I read this: https://v2.canjs.com/docs/can.List.plugins.sort.html but just couldn’t apply it to my promise-scheme.

in the model I tried this:

Story.List = can.List.extend({
  Map: Story,
  comparator: 'order'
}, {});

and this:

Story.List = can.List.extend({
  Map: Story
}, {}).attr("comparator", 'order’);
Nico R.
@nriesco
Jan 15 2017 02:38
that was the closest I got to the example syntax shown in https://v2.canjs.com/docs/can.List.plugins.sort.html
var people = new can.List([
    {name: "Alexis", num: 4, age: 88},
    {name: "Brian", num: 2, age: 31},
    {name: "Mihael", num: 3, age: 25},
    {name: "Curtis", num: 5, age: 15},
    {name: "David", num: 6, age: 55},
  ]).attr("comparator","num”);
Matthew Phillips
@matthewp
Jan 15 2017 10:58
@justinbmeyer We should stop encouraging people to use it then.
Frank Lemanschik
@frank-dspeed
Jan 15 2017 14:24
@matthewp cant we simply stop all this pre stuff is pre realy needed
cant the api's be defined and hold stable
its only interface related most time
i think its often totally clear what a component aka module takes and this can be defined as the modules api version
then no changes to the api version needed most times for long long time
and the code versions can be treated in a totall indipenedent way
I know this concepts from realy big applcations like Linux Distributions
there we keep api/abi versions seperated for every module aka application aka package :)