Where communities thrive


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

    greenkeeper[bot] on @octokit

    (compare)

  • 03:57

    greenkeeper[bot] on @octokit

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

  • Sep 20 21:04
    m-mujica commented #5303
  • Sep 20 20:23
    m-mujica opened #5303
  • Sep 20 20:23

    m-mujica on upgrade-deps

    Update can-type and can-stache-… (compare)

  • Sep 20 20:05
    m-mujica edited #5302
  • Sep 20 20:03
    m-mujica synchronize #5302
  • Sep 20 20:03

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight Use svg images (instead of .png) (compare)

  • Sep 20 19:32
    m-mujica opened #5302
  • Sep 20 19:29

    m-mujica on upgrade

    Upgrade routing guide to Can 6 Fix incorrect highlight (compare)

  • Sep 20 17:42

    m-mujica on upgrade

    WIP: Upgrade (compare)

  • Sep 20 17:06
    do-adams starred canjs/canjs
  • Sep 20 13:34

    chasenlehara on 5119-testing-guide

    Update the Testing guide for Ca… (compare)

  • Sep 20 13:21
    cherifGsoul commented #5295
  • Sep 20 13:18
    cherifGsoul synchronize #5295
  • Sep 20 13:18

    cherifGsoul on update-theme-new-buttons

    Theme pre-release 2 (compare)

  • Sep 20 10:29

    greenkeeper[bot] on socket.io-client-2.3.0

    (compare)

  • Sep 20 10:26

    greenkeeper[bot] on socket.io-client-2.3.0

    chore(package): update socket.i… (compare)

  • Sep 20 06:40
    HellMagic starred canjs/canjs
  • Sep 19 20:42
    m-mujica commented #5119
Eben
@eben-roux
do you know how I would get the viewModel in that method?
pffft... nevermind
"this"
Chasen Le Hara
@chasenlehara
@Pestdoktor Is that with the Map polyfill? Does it work without it?
Pestdoktor
@Pestdoktor
without any polyfill it complains about missing assign method: https://hastebin.com/raw/oricomajak
Justin Meyer
@justinbmeyer
@Lighttree I think something like Context API is a foot-gun ... it makes things simple at first, but difficult to reuse and test later.
I think it's better to at least pass the "global" state ... you can always do: <sub-component state:from="this"> where this is your global state. By passing, you at least allow someone to pass a different state value.
Justin Meyer
@justinbmeyer
I've also thought about supporting object (or hash) so you can select what actually gets put into state:
<sub-component state:from="{propA, probB: valB}">
Justin Meyer
@justinbmeyer
canjs/can-stache#505
Viktor Busko
@Lighttree

Hi @Lighttree, we’re only testing CanJS 4 in Edge and not IE 11.
You can see what the test suite runs here: https://github.com/canjs/canjs#canjs
We’re open to adding support for IE11, it just hasn’t been a priority because none of our projects have required it and this is the first time it’s come up. 🙂

@chasenlehara In this case what is current browser support for CanJS ? Is it valid to create bugs for IE11? I'm not sure in which project create it, because I wasn't able figure out the reason of such behavior.

Eben
@eben-roux
I'm trying to bind a method to a component attribute like so: click:from="@scope@root@edit(.)" and I've tried quite a few variants but it just doesn't seem to be passed. Any ideas?
Viktor Busko
@Lighttree
@eben-roux Is it CanJS 3 or 4 ?
Eben
@eben-roux
hi, that is canjs 4
Viktor Busko
@Lighttree
@eben-roux there is changes in how you pass methods to components. https://www.bitovi.com/blog/canjs-4.0#simplified-stache
Eben
@eben-roux
if I use on:click="scope.root.edit(.)" directly on, say, a <div> it works fine, but I need to pass that to my component and I don't seem to be able to do that
the component would then call the passed method
Justin Meyer
@justinbmeyer
@roemhildtg looks great!
@Lighttree yes, it's totally valid. We want to support IE11 (except for can-observe). We just didn't want to be weighed down by it for release. Our goal will probably to support IE11 given certain polyfills people should include.
@eben-roux ... I'm confused ... your original example had click:from ... is that a mistake? Should it be on:click? What do you mean "bind a method to a component"? Do you mean that this isn't right in edit? If that's true, that's a bug.
I'm confused because you're talking about "passing" AND showing listening to a click.
Viktor Busko
@Lighttree
@justinbmeyer well, yeah I think that It should work with polyfills and it works for CanJS 3. But in 4th it works different. Where I can rise the bug ?
Here is stacktrace for the issue that I refer to:
https://hastebin.com/raw/qesivazazo
These undefined looks weird.
Justin Meyer
@justinbmeyer
you can file them in canjs/canjs: https://github.com/canjs/canjs/issues/new
I know there's certain things IE11's map does not support ... we can probably avoid all of them.
Viktor Busko
@Lighttree
canjs/canjs#4100
Justin Meyer
@justinbmeyer
thanks
Viktor Busko
@Lighttree
np
henst922
@henst922
Hi! Is there something similar to this https://www.npmjs.com/package/react-router-modal to handle routing to a modal with canjs?
Justin Meyer
@justinbmeyer

@henst922 CanJS has a two-way routing system, so it wouldn't match specific urls. Though you can match certain state.

This JSBin shows how to create a generic modal: http://jsbin.com/misigo/edit?html,js,output

can.Component.extend({
    tag: "my-modal",
    view: `
          <div class='background'></div>
          <div class='modal-container'>
            <h3>{{title}}</h3>
            <div class='modal-contents'><content></content></div>
          </div>`
});
With CanJS, you would have something like:
{{#if( routeCurrent(page='todos') ) }}
  <my-modal title:raw="Wanna Save?">
      CONTENT FOR YOUR MODAL
  </my-modal>
{{/if}}
basically, if your route data's state matches page=todos ... it will render the modal
@henst922 canjs's routing system is quite a bit different from other routing systems. It's worth reading up on: https://canjs.com/doc/guides/technology-overview.html#Observablesandthebrowser_slocation
Eben
@eben-roux
@justinbmeyer : I'll put together a jsbin example just to ensure I'm not doing something odd. I want to use a method on my view model within a component that is rendered in an {{#each}}. I therefore need to get to the scope.root.mymethod as I understand. The component has to call the method that is bound by rendering the on:click to the method: something like:
{{#each(subObjects)}}
   <my-component click:from="scope.root.the-method-on-the-main-viewmodel" />
{{/each}}
Justin Meyer
@justinbmeyer
@eben-roux , so you are setting click on my-component's VM to that method
I think there might be a bug because I think that methods are supposed to be auto bound
Eben
@eben-roux
@justinbmeyer I think I missed the whole function binding boat :) --- having a look now on a jsbin
Justin Meyer
@justinbmeyer
I would call the click property something else. It's a bit confusing. Maybe clickCallback
This should work though:
<my-comp clickCallback:from="scope.root.method.bind(scope.root)">
it's possible that scope.root.X isn't being auto-bound. This happens in can-key-tree cc @phillipskevin
Eben
@eben-roux
so, my bad... just wasn't using it correctly by the looks of it
Kevin Phillips
@phillipskevin
not sure if you cleared this up correctly, but scope.root.X should get called with the correct context automatically
if you find a case where it isn't, it's a bug for sure
Eben
@eben-roux
wrapping one's head around all these levels of binding takes some practice --- it'll probably get easier with time
Justin Meyer
@justinbmeyer
can-stache-bindings_key.png
columns are:
binding example | direction of binding | value in the scope | pseudo code of what binding sets up
that's from this presentation: https://drive.google.com/open?id=0Bx-kNqf-wxZeYUJ3ZVRxUlU2MjQ .... it hasn't been updated for 4.0, but still covers the 3.0 bindings
Dovid Bleier
@dbleier
Hi All, having some issues with the new can4.0 value and using its listenTo method. In my test cases, works perfectly but in the actual app, the listenTo callback isn't getting called, although interestingly enough, the value method itself is
export const ViewModel = DefineMap.extend({
    units: {
        default: () => { return []; },
    },
    users: {
        value: function(prop) {
            prop.resolve({});
            prop.listenTo(prop.lastSet, prop.resolve);
            prop.listenTo('units', (target, newval, oldval) => {
                let organizeUnits = (users, user, sign, unit) => {
                        users[user] = users[user] || {};
                        users[user][sign] = users[user][sign] || [];
                        users[user][sign].push(unit);
                        return users;
                    },
                    users = newval.reduce((users, unit) => {
                        return organizeUnits(users, unit.user || 'unassigned',
                            unit.currentSign ? unit.currentSign.path : 'unassigned', unit.serialize());
                    }, {});
                prop.resolve(users);
            });
        }
    },