Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 18 22:20
    greenkeeper[bot] labeled #5391
  • Oct 18 22:20
    greenkeeper[bot] opened #5391
  • Oct 18 22:20

    greenkeeper[bot] on can-observable-mixin-1.0.3

    fix(package): update can-observ… (compare)

  • Oct 18 19:08
    cherifGsoul labeled #5390
  • Oct 18 19:07
    cherifGsoul opened #5390
  • Oct 18 18:45
    greenkeeper[bot] labeled #5389
  • Oct 18 18:45
    greenkeeper[bot] opened #5389
  • Oct 18 18:45

    greenkeeper[bot] on can-observable-bindings-1.3.0

    fix(package): update can-observ… (compare)

  • Oct 18 18:29

    matthewp on master

    Update dist for release (compare)

  • Oct 18 18:29

    matthewp on v6.1.3

    Update dist for release 6.1.3 (compare)

  • Oct 18 17:59

    matthewp on can-observable-array-1.0.2

    (compare)

  • Oct 18 17:59

    matthewp on master

    fix(package): update can-observ… Merge pull request #5388 from c… (compare)

  • Oct 18 17:59
    matthewp closed #5388
  • Oct 18 16:46
    greenkeeper[bot] labeled #5388
  • Oct 18 16:46
    greenkeeper[bot] opened #5388
  • Oct 18 16:46

    greenkeeper[bot] on can-observable-array-1.0.2

    fix(package): update can-observ… (compare)

  • Oct 18 12:45
    greenkeeper[bot] labeled #5387
  • Oct 18 12:45
    greenkeeper[bot] opened #5387
  • Oct 18 12:45

    greenkeeper[bot] on can-stache-element-1.0.2

    fix(package): update can-stache… (compare)

  • Oct 18 09:49
    chasenlehara edited #5384
Kevin Phillips
@phillipskevin
please feel free to open issues
Christopher Oliphant
@RALifeCoach

I’m back. I am trying to fire an event. Inside the component I have:

        events: {
            'highlightplayer': function () {
                debugger;
            },

and in the parent module I have:

$(#myId’).trigger(‘highlightplayer’);

I also tried:

can.event.dispatch.call($(‘myId’), ‘highlightplayer’);
myId is assigned in the stache fragment for the component
Mohamed Cherif Bouchelaghem
@cherifGsoul
'#myId highlightplayer': function () {
                debugger;
            },
Christopher Oliphant
@RALifeCoach
okay - I used it without the #myId because the docs say:
events: {
    "click" : function(){
      var currentMessage = this.viewModel.attr("message");
      this.viewModel.attr("message", currentMessage+ "!")
    }
  }
Mohamed Cherif Bouchelaghem
@cherifGsoul
It listens to click event on the component tag
Christopher Oliphant
@RALifeCoach
The id in my case isn’t fixed. It is actually ‘xxx-‘ + pid
Mohamed Cherif Bouchelaghem
@cherifGsoul
use classes
class="js-my-el"
'.js-my-el highlightplayer': function () {
                debugger;
            }
Kevin Phillips
@phillipskevin
you can put the event in your template also
Christopher Oliphant
@RALifeCoach
but the component is repeated many times on the page - therefore the class would be repeated
Kevin Phillips
@phillipskevin
($highlightPlayer)=“highlightPlayer”
Christopher Oliphant
@RALifeCoach
I only want the change to apply to this row
that’s why the id is distinct
@phillipskevin isn’t that discouraged due to the performance impact?
Kevin Phillips
@phillipskevin
only if you’re going to have thousands of this component
Christopher Oliphant
@RALifeCoach
If I specify it as you indicated, then I can use the event as shown above?
Kevin Phillips
@phillipskevin
if you do it that way, highlightPlayer would be a function on your viewmodel
Christopher Oliphant
@RALifeCoach
and how do I fire it as an event from outside the component?
$.trigger
or can.trigger
Christopher Oliphant
@RALifeCoach
Kevin Phillips
@phillipskevin
no, it doesn't
the ($highlight)=“highlight” has to be on the same element you’re triggering the event on
Christopher Oliphant
@RALifeCoach
right - thanks
Kevin Phillips
@phillipskevin
no problem
Thomas Sieverding
@Bajix
@RALifeCoach How’s the project coming along?
Thomas Sieverding
@Bajix
How do I read/write to the root scope w/in a component
Thomas Sieverding
@Bajix
How does %root work?
dylanrtt
@dylanrtt
@Bajix %root is just a child map of all components' viewmodels, so you can do this.attr('%root.foo') or this.attr('%root.foo', bar)
Thomas Sieverding
@Bajix
dylanrtt
@dylanrtt
are you asking how to use it in a template?
Thomas Sieverding
@Bajix
yes
My impression was that I’d be able to do <foo *bar> … {{*bar.someProp}} ..</foo>
I’m a little confused though, as I had expected %root.bar to be set as the exported vm
dylanrtt
@dylanrtt
scope lookups to component viewmodels don't fall-through to %root if that's what you are thinking
whereas scope in the template does (not sure if I said that right)
Thomas Sieverding
@Bajix
I see - I had thought %root was the template scope
dylanrtt
@dylanrtt
This message was deleted
Thomas Sieverding
@Bajix
%root is the top most ref?
So if you’re doing leakScope: false, then child components would have %root === the vm of the parent
dylanrtt
@dylanrtt
yes, the top most ref
shouldn't matter with leakScope:whatever
Thomas Sieverding
@Bajix
That’s inconsistent w/ the docs. *bar should be the vm itself
dylanrtt
@dylanrtt
oh sorry my bad, I don't usually use that syntax
Thomas Sieverding
@Bajix
Well, leakScope would just mean that it’s now the top most ref
So if I had <my-app *app><my-service>{{>views/index}}</my-service></my-app>, shouldn’t I be able to do {{*app.foo}} within index?
dylanrtt
@dylanrtt
I don't think so. *app would only be available within the outer template. They are not passed down