Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 18 23:43
    1d0n7kn0w starred canjs/canjs
  • Feb 14 12:04
    CalvinWalzel starred canjs/canjs
  • Feb 13 05:42
    liyanlong starred canjs/canjs
  • Feb 11 22:25
    greenkeeper[bot] commented #5450
  • Feb 11 22:25

    greenkeeper[bot] on semver-7.1.3

    chore(package): update semver t… (compare)

  • Feb 11 19:20

    greenkeeper[bot] on steal-tools-2.2.6

    (compare)

  • Feb 11 19:06

    greenkeeper[bot] on steal-tools-2.2.6

    chore(package): update steal-to… (compare)

  • Feb 11 11:17

    greenkeeper[bot] on webpack-4.41.6

    (compare)

  • Feb 11 11:06

    greenkeeper[bot] on webpack-4.41.6

    chore(package): update webpack … (compare)

  • Feb 10 23:01
    cherifGsoul commented #5468
  • Feb 10 23:00
    cherifGsoul reopened #5468
  • Feb 10 22:59
    cherifGsoul closed #5468
  • Feb 10 22:59
    cherifGsoul commented #5468
  • Feb 09 05:23
  • Feb 08 20:24
    piraz opened #5468
  • Feb 08 10:41
    randy-r starred canjs/canjs
  • Feb 07 23:40
  • Feb 07 23:40
    MedRedha starred canjs/canjs
  • Feb 03 22:16

    greenkeeper[bot] on @octokit

    (compare)

  • Feb 03 22:15

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

Julian
@pYr0x
it says mustache...
Mohamed Cherif Bouchelaghem
@cherifGsoul
it should works readme file has a stache example
Kevin Phillips
@phillipskevin
@RALifeCoach would it be easier to pass a unique argument for each place its being called in your stache file?
or comment them out one-by-one
Mohamed Cherif Bouchelaghem
@cherifGsoul
@jeroencornelissen you can just listen to the app state changes for your case, or you have specific reason why you have to know when template is redered?
Jeroen Cornelissen
@jeroencornelissen
@cherifGsoul what do you mean with app state changes?
I needed to know when the template is rendered because I wanted to focus the first form element.
Christopher Oliphant
@RALifeCoach
@phillipskevin - execllent idea - the can.compile wasn’t useful
Christopher Oliphant
@RALifeCoach
Now I am really confused
I have a simple method on my Map
isActive: function (ctr) {
            return this.playerRow.player.status.toLowerCase() === 'active';
        },
The first time it is called, all is well. The second time it is called, the value of this.playerRow has changed. That is while parsing the same stache file.
The first call {{^if isActive('1')}} and the second call <a class="name {{#if isActive('2')}}expansion{{/if}}”
Kevin Phillips
@phillipskevin
is playerRow an attribute on your map?
Christopher Oliphant
@RALifeCoach
yes
Kevin Phillips
@phillipskevin
you probably want to use .attr(‘playerRow…’) then
Christopher Oliphant
@RALifeCoach
why does it work once, but not the second time?
Kevin Phillips
@phillipskevin
I’m not really sure what you mean
it sounds like playerRow is being set some time while your template is rendering
Julian
@pYr0x
only .attr() let can.compute know about accesing the property
Kevin Phillips
@phillipskevin
if you use .attr() it will render the section with ‘1’ then render the section with ‘2’ then re-render the section with ‘1’ again because playerRow changed
Christopher Oliphant
@RALifeCoach
I will change them all to attrs and keep you posted
Kevin Phillips
@phillipskevin
ok
you can do this.attr(‘playerRow.player.status’)
Christopher Oliphant
@RALifeCoach
the second time this.playerRow.attr('player’) gives <not available>
Kevin Phillips
@phillipskevin
should be this.attr(‘playerRow.player’)
Christopher Oliphant
@RALifeCoach
sorry, I thought either would work - I will make the change
Kevin Phillips
@phillipskevin
the first will only trigger a render if player changes
but if playerRow changes it won't
Christopher Oliphant
@RALifeCoach
I don’t want either player or player row to change
I am simply trying at access them to test for a value
Kevin Phillips
@phillipskevin
I know you don’t want them to change
something sets playerRow
before that, playerRow will be undefined
so in order for your template to render when playerRow changes from undefined to the correct value, you need to listen to when playerRow changes
Christopher Oliphant
@RALifeCoach
are you suggesting I create an event on playerRow?
Kevin Phillips
@phillipskevin
no
using .attr() sets up a listener internally
so that stache knows to recompute your isActive function
and re-render
Mohamed Cherif Bouchelaghem
@cherifGsoul
@jeroencornelissen my-form should be removed and inserted everytime activeForm change
Christopher Oliphant
@RALifeCoach
@phillipskevin I made the change you requested (after being pulled away to work on two other priorities)
isActive is getting called again with ctr = 1
therefore playerRow is getting altered - the question is where?
is the stache file parsed and populated on the main thread?
Kevin Phillips
@phillipskevin
yes
can you just bind on playerRow and look at the stack trace to see what is changing it?
Christopher Oliphant
@RALifeCoach
can I bind in the Map events: { playerRow: function () […
or does it need to be on the component?
Kevin Phillips
@phillipskevin
on the map, you can add an init
then do
  init: function() {
    this.bind(‘playerRow’, function() { … });
  }
Christopher Oliphant
@RALifeCoach
BTW there is no Map.init in the documentation