Where communities thrive


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

    matthewp on master

    Update dist for release (compare)

  • 20:11

    matthewp on v6.2.0

    Update dist for release 6.2.0 (compare)

  • 20:05

    matthewp on master

    Fix bundlesize (compare)

  • 19:22

    matthewp on can-observable-bindings-1.3.0

    (compare)

  • 19:22

    matthewp on master

    fix(package): update can-observ… Set new bundle sizes Merge pull request #5389 from c… (compare)

  • 19:22
    matthewp closed #5389
  • 19:09
    matthewp commented #5389
  • 18:33

    matthewp on can-attribute-observable-2.0.1

    (compare)

  • 18:33

    matthewp on master

    fix(package): update can-attrib… Increase the bundlesize Merge pull request #5394 from c… (compare)

  • 18:33
    matthewp closed #5394
  • 17:59
    matthewp synchronize #5394
  • 17:59

    matthewp on can-attribute-observable-2.0.1

    Increase the bundlesize (compare)

  • 17:42
    matthewp synchronize #5389
  • 17:42

    matthewp on can-observable-bindings-1.3.0

    fix(package): update can-observ… Set new bundle sizes (compare)

  • 17:26
    greenkeeper[bot] labeled #5394
  • 17:26
    greenkeeper[bot] opened #5394
  • 17:26

    greenkeeper[bot] on can-attribute-observable-2.0.1

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

  • 17:15

    matthewp on can-stache-element-1.0.2

    (compare)

  • 17:15

    matthewp on master

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

  • 17:15
    matthewp closed #5387
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);
            });
        }
    },
units is set by an outside component via stache scope bindings
so each time units is updated the users.value method is called, but the prop.listenTo('units', ...) is not
I could just move the code right into the value method, but that doesn't seem right
Justin Meyer
@justinbmeyer
@dbleier this is likely a source of confusion we've been seeing over and over
listenTo only fires when an event is fired
it isn't called with the initial value of units
well, judging by how you called resolve() initially, you might be aware of this
basically value() will be called either:
  • when someone reads an unbound users property, OR
  • the first time someone binds to users
We've been thinking of adding a onValue to complement listenTo