Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:24

    greenkeeper[bot] on @webcomponents

    (compare)

  • 08:07

    greenkeeper[bot] on @webcomponents

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

  • Feb 27 17:39
    JuanFelix88 starred canjs/canjs
  • Feb 26 05:49
    hawk-ee starred canjs/canjs
  • Feb 25 18:23
    jxjxnyc starred canjs/canjs
  • Feb 25 14:59
    simondarke starred canjs/canjs
  • Feb 24 04:06
    BenitoJedai starred canjs/canjs
  • Feb 21 16:19
    cherifGsoul labeled #5427
  • Feb 21 16:19
    cherifGsoul labeled #5427
  • Feb 21 16:15
    cherifGsoul labeled #5433
  • Feb 21 16:15
    cherifGsoul commented #5433
  • Feb 21 15:53
    cherifGsoul labeled #5464
  • Feb 21 15:51
    cherifGsoul labeled #5465
  • Feb 21 15:51
    cherifGsoul labeled #5466
  • Feb 21 15:49
    cherifGsoul labeled #5467
  • Feb 21 15:45
    cherifGsoul labeled #5468
  • Feb 21 15:44
    cherifGsoul labeled #5468
  • Feb 20 20:57
  • Feb 20 20:42
    greenkeeper[bot] labeled #5469
  • Feb 20 20:42
    greenkeeper[bot] opened #5469
Christopher Oliphant
@RALifeCoach
{{#if helper(arg1, arg2)}}{{/if}}
Sunil George
@georgesunil81
Ah! That is what I was missing, let me try that.
Thanks @RALifeCoach
Christopher Oliphant
@RALifeCoach
You’re welcome
Sunil George
@georgesunil81
Yes, it worked. Thanks @RALifeCoach for the quick help.
Leath Cooper
@IcculusC
o/
anyone have any insight on what's going on here canjs/can-component#27
Christopher Oliphant
@RALifeCoach
Hi all. In 2.3 I could reference this.element.attr. In 3.0 I am getting an error. What’s different in 3.0?
Christopher Oliphant
@RALifeCoach
In 3.0 I can use $(this.element).find, but not $(this.element).attr
Ignore the last comment $(this.element).attr works
Leath Cooper
@IcculusC

@RALifeCoach as far as I understand in 3.0 .attr no longer exists, instead there are automatically populated getters and setters, so where you would have said

let foo = this.attr('bar');

you would now say

let foo = this.bar;

and to set the value of the attribute you'd say

this.bar = someValue;

unless you are trying to get an attribute from the DOM element which would be $(this.element).attr I believe(don't quote me on that part)

I mean, that last bit will work, but not sure if there's a better way within canjs
Matthew Phillips
@matthewp
@halcyonandon fair enough, what would you recommend calling that package then?
Sunil George
@georgesunil81
A quick question - I am getting these warning messages in the console when my staches are rendered -
```
WARN: can/view/stache/mustache_core.js: Unable to find key or helper "client.firstName".
Although the client.firstName shows up on screen, then why is the warning message thrown?
Also, how can I prevent these stache warning messages from showing up in the logs!?
Matthew Phillips
@matthewp
there's a can.dev.logLevel you can set
set it to 2 I think to turn those off
Sunil George
@georgesunil81
Thanks @matthewp for your inputs. I will check on the logLevel property.
Any idea why these warning messages would come up in the first place. Is it because the key is not set on scope when the stache is rendered, but is then later and that is why is shows up on screen?!
Christopher Oliphant
@RALifeCoach
I have created a simple connect (in 3.0) for performing a get. The connect code is:
connect([
    require('can-connect/data/url/url'),
    require('can-connect/constructor/constructor'),
    require('can-connect/can/map/map')
], {
    Map: Players,
    url: config.playersUrl
});
playersUrl is playersUrl: '/modules/page.players-redesign/player-bio/data/players.json’
When I run the code and check the network request, it is asking for "http://localhost:8090/modules/page.players-redesign/player-bio/null?"
can I issue a get on a json file? does a get have to have id data provided?
Here is my get:
           Players.get({}).then($.proxy((data)=>{
                console.log(data);
                this.onPlayersData(data);
            })).catch((err)=>console.log(err));
Matthew Phillips
@matthewp
@georgesunil81 that's exactly why you get the warnings
if you give them an initial value the warnings will go away
Sunil George
@georgesunil81
Thanks so much @matthewp. Will do.
Another hopefully quick question - I am trying to use jquery to scroll to the bottom of my div like below -
$("#message-thread-panel").animate({ scrollTop: $('#message-thread-panel').prop("scrollHeight")}, 1);
Sunil George
@georgesunil81
The div is inside a stache file that gets populated by scope variables (which in turn get populated via API calls). The problem I am facing is that the scroll sometime works and sometimes it does not. It seems that I need to execute the jquery statement only when the div is completed population. How do I wait for the stache variables to update the view and then execute the above jquery statement?
Matthew Phillips
@matthewp
Listen to the change in the events
if it's a list something like '{viewModel list} length': function() { ... }
where list is the viewModel's list property
whatever the name of that property is
this will execute when the length changes
so you can do your animation there
probably best in a requestAnimationFrame
Sunil George
@georgesunil81
Thanks @matthewp . I guess the '{viewModel list} length': function() { ... } would get called once the stache is rendered completely with all the list items. If that is the case, the animation method will indeed get the correct div height (which depends on the number of list items).
Christopher Oliphant
@RALifeCoach
Any comments on my issue?
Christopher Oliphant
@RALifeCoach
@Bajix @cherifGsoul @matthewp Any help is much appreciated.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@RALifeCoach use can-fixture
Christopher Oliphant
@RALifeCoach
Is there a 3.0 version of can-fixture?
Mohamed Cherif Bouchelaghem
@cherifGsoul
yes
the docs show how to use it with a json file
Christopher Oliphant
@RALifeCoach
const Players = Map.extend({
    define: {
        header: {
            Type: Object
        },
        plrs: {
            Type: Object
        }
    }
});

connect([
    require('can-connect/data/url/url'),
    require('can-connect/constructor/constructor'),
    require('can-connect/can/map/map')
], {
    Map: Players,
    url: '/players'
});

fixture("GET /players", config.playersUrl);

export default Players;
Here is what I tried, but the results are the same.