by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 29 13:17
    ko25july starred canjs/canjs
  • Sep 21 17:41
    cherifGsoul assigned #5508
  • Sep 21 17:39
    cherifGsoul opened #5508
  • Sep 18 19:32
  • Sep 11 02:59
    torongu starred canjs/canjs
  • Sep 09 06:57
    tbreuss starred canjs/canjs
  • Sep 04 18:58
    cherifGsoul review_requested #5507
  • Sep 04 18:58
    cherifGsoul opened #5507
  • Sep 04 18:51

    cherifGsoul on post-release-script

    Add GitHub release automation (compare)

  • Aug 22 17:54
    ThisIsntMyId starred canjs/canjs
  • Aug 21 08:54
  • Aug 20 20:24
    ktitaro starred canjs/canjs
  • Aug 17 16:53
  • Aug 17 16:51
    kuustudio starred canjs/canjs
  • Aug 14 17:12
    cherifGsoul closed #5494
  • Aug 14 17:07
    cherifGsoul labeled #5490
  • Aug 14 17:05
    cherifGsoul labeled #5492
  • Aug 14 17:04
    cherifGsoul closed #5495
  • Aug 14 17:04
    cherifGsoul closed #5498
  • Aug 13 07:25
    kitoki starred canjs/canjs
Christopher Oliphant
@RALifeCoach
instance of?
Thomas Sieverding
@Bajix
And you don’t pass it the promise, you pipe it the AJAX request
Christopher Oliphant
@RALifeCoach
Model?
Thomas Sieverding
@Bajix
yes
Christopher Oliphant
@RALifeCoach
I DON’T HAVE AJAX
I have said that so many times now.
Thomas Sieverding
@Bajix
Whatever the data source is, doesn’t matter, I was giving you an example
Christopher Oliphant
@RALifeCoach
I have a player object - that’s it
Thomas Sieverding
@Bajix
var playerRowMap = PlayerRowMap.model(myDataPJSO)
That’s it
Christopher Oliphant
@RALifeCoach
okay
Thomas Sieverding
@Bajix
playerRowMap instanceof PlayerRowMap === true
Christopher Oliphant
@RALifeCoach
alright - that worked and is better timing then my last attempt
however, the updating is still taking a while
Thomas Sieverding
@Bajix
One issue at a time
Christopher Oliphant
@RALifeCoach
alright then suggest how best I update the model for maximum efficiency
I will read your response in the morning
Thomas Sieverding
@Bajix
1) Pass around map instances instead of cross-binding properties to components
2) Use one-way binding whenever applicable
3) Use leakScope: false whenever applicable
4) Use ./ within your bindings
Thomas Sieverding
@Bajix
5) Use computes like a mad man. The goal is to lower unnecessary change events. For example, the isAdmin getter I described above is actually really performant, as now I can bind to it elsewhere, and something like changing users or logging in that would trigger isAdmin to be re-computed wouldn’t trigger other computes that are dependent on isAdmin from re-computing if isAdmin doesn’t change
isAdmin: {
  get: function() {
    var profile = this.attr('profile');

    if (profile) {
      return profile.attr('tier') === config.tiers.indexOf('admin');
    }

    return false
  }
}
Changing profile / tier would recompute this. But if the value hasn't changed, computes dependent on this wouldn't recompute
Julian
@pYr0x
@Bajix you mean, that computes are cached...?
how look like the worse isAdmin method?
Christopher Oliphant
@RALifeCoach
@pYr0x parseModel isn’t producing any better results than simply using type: ‘*’ for objects not needing observables
Julian
@pYr0x
ok.. and what about the point 5) bajix said?
also 3) and 4) are good points
to look at
Christopher Oliphant
@RALifeCoach
computes give a way to handle events outside of the component when attributes within the map associated with the component change
I don’t really have a need for that
When I turned on leakScope - everything stopped working
All my data is in the viewModel, not in the outer scope
I haven’t tried ./ and I must confess I am not sure what that means
I don’t recall seeing that in the docs
Christopher Oliphant
@RALifeCoach
@pYr0x can you please point to the docs for ./
Jeroen Cornelissen
@jeroencornelissen
Christopher Oliphant
@RALifeCoach
Thanks
Kevin Phillips
@phillipskevin
@RALifeCoach one thing I would test is how much of the DOM is being updated when you make a change
Christopher Oliphant
@RALifeCoach
sure
Kevin Phillips
@phillipskevin
you can turn on paint rectangles in chrome dev tools
Christopher Oliphant
@RALifeCoach
how do you want to do that?
then when you change something, the piece of the DOM that was updated should flash green
Christopher Oliphant
@RALifeCoach
I am not seeing any of it flash green during load or reload
Kevin Phillips
@phillipskevin
ok, when you say “updating is taking a while” what do you mean exactly?
Christopher Oliphant
@RALifeCoach
var stache1 = new Date().getTime();
                this.playerRowMap.attr({'player': request.player});
var stache2 = new Date().getTime();
pgatour.stacheTime += stache2 - stache1;
at the end of 156 updates the total accumulated time is 1.8 seconds
Kevin Phillips
@phillipskevin
but that’s not noticeable by the user?
Christopher Oliphant
@RALifeCoach
I notice it
Kevin Phillips
@phillipskevin
how?