Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 12 19:26
    cherifGsoul review_requested #5443
  • Dec 12 18:34
    cherifGsoul synchronize #5443
  • Dec 12 18:34

    cherifGsoul on document-inserted-removed-can6

    Update after review (compare)

  • Dec 12 17:44

    cherifGsoul on theme-3.0.0-pre.5

    (compare)

  • Dec 12 17:44

    cherifGsoul on master

    Update bit-doc-html-canjs (#544… (compare)

  • Dec 12 17:44
    cherifGsoul closed #5445
  • Dec 12 17:01
    cherifGsoul opened #5445
  • Dec 12 17:01

    cherifGsoul on theme-3.0.0-pre.5

    Update bit-doc-html-canjs Upda… (compare)

  • Dec 12 16:40

    cherifGsoul on update-api-page

    (compare)

  • Dec 12 16:39

    cherifGsoul on master

    Update API page (#5432) * Upda… (compare)

  • Dec 12 16:39
    cherifGsoul closed #5432
  • Dec 12 16:39
    cherifGsoul closed #5304
  • Dec 12 01:04
    greenkeeper[bot] commented #5392
  • Dec 12 01:04

    greenkeeper[bot] on core-js-3.5.0

    chore(package): update core-js … (compare)

  • Dec 11 18:34
    greenkeeper[bot] labeled #5444
  • Dec 11 18:34
    greenkeeper[bot] opened #5444
  • Dec 11 18:34

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

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

  • Dec 11 18:30

    cherifGsoul on update-infrastructure-page

    (compare)

  • Dec 11 18:30

    cherifGsoul on master

    Update infrastructure page with… (compare)

  • Dec 11 18:30
    cherifGsoul closed #5441
Christopher Oliphant
@RALifeCoach
That isn’t exactly intuitive, but it works. Thank-you.
Kevin Phillips
@phillipskevin
I think it would simplify things a lot if we could figure out a way to pass the viewmodel in the conventional way
Christopher Oliphant
@RALifeCoach
Actually, this is a really nice way of handling things. With the map being instantiated outside of the component lets me update the map as needed and that automatically updates the html. For really large systems and legacy systems, this is a real boon.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach I know you are converting a legacy app, but things withcanjs can be done in simpler way
Christopher Oliphant
@RALifeCoach
There is a huge difference between writing new code and a slow transition in an existing legacy system. Especially when the legacy system has 100’s of thousands of lines of code. To make the tool really useful, these features become really import in these situations.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach yes, we are happy we can help you :)
Christopher Oliphant
@RALifeCoach
In fact, to make a few changes to make this simpler could greatly extend the reach of this tool into other companies and environments.
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