Where communities thrive


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

    matthewp on master

    Update dist for release (compare)

  • Oct 22 20:11

    matthewp on v6.2.0

    Update dist for release 6.2.0 (compare)

  • Oct 22 20:05

    matthewp on master

    Fix bundlesize (compare)

  • Oct 22 19:22

    matthewp on can-observable-bindings-1.3.0

    (compare)

  • Oct 22 19:22

    matthewp on master

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

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

    matthewp on can-attribute-observable-2.0.1

    (compare)

  • Oct 22 18:33

    matthewp on master

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

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

    matthewp on can-attribute-observable-2.0.1

    Increase the bundlesize (compare)

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

    matthewp on can-observable-bindings-1.3.0

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

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

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

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

  • Oct 22 17:15

    matthewp on can-stache-element-1.0.2

    (compare)

  • Oct 22 17:15

    matthewp on master

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

  • Oct 22 17:15
    matthewp closed #5387
James Atherton
@James0x57
I didn't specifically test that, but that should work no problem - just declare both named partials in the template and they should be able to reference each other
Glad you like it :D
Gregg Roemhildt
@roemhildtg
I do. I also just learned you can pass a scope to a partial
James Atherton
@James0x57
Just tested, they can reference each other:
    test('named partials can reference each other (canjs/can-stache/issues/3)', function(){
        var template = "{{<foo}}hello {{>bar}}{{/foo}} {{<bar}}world{{/bar}} <span>Test:</span><div>{{>foo}}</div>";
        var intermediate = parser( template, {}, true );

        var renderer = stache(intermediate);
        var data = new CanMap( {} );
        var frag = renderer( data );

        equal( innerHTML( frag.lastChild ), "hello world" );;
    });
Gregg Roemhildt
@roemhildtg
So I could do something like
{{<name}}
{{#if userName}}
<b>{{userName}}</b> <!-- if username exists render bold username -->
{{else}}
{{>bar}} <!-- otherwise render a default partial defined in the template-->
{{/if}}
{{>name}}
for example
James Atherton
@James0x57
Sure. I imagine it'll be used for more complex composition but that'd work as a test. Gotta close the {{<name}} tag with {{/name}} though
Gregg Roemhildt
@roemhildtg
Yup, good catch. I use partials a lot, (maybe too much) to override different parts of a page component based on a data type. So now I could create the partial in the template and if a partial gets passed to the component, that partial can render the partial defined in the template if it wants to
James Atherton
@James0x57
yup
:)
Nico R.
@nriesco
@James0x57 what do I need to do yo use named partials? (canjs/can-stache#3) update my canjs version?
Nico R.
@nriesco
And is there a working example (jsbin?)
Kevin Phillips
@phillipskevin
@nriesco it will be in canjs soon if you're using the main can package
otherwise, just update to can-stache 3.6.0
Nico R.
@nriesco
cool, thanks @phillipskevin
kostya.aderiho
@kaderiho

Hi all, I have the next DefineMap instance:

const Attachment = DefineMap.extend({
    attachmentTO: {
        attachmentType: 'string',
        resourceType: 'string',
        contentType: 'string',
        entityType: 'string',
        entityId: 'string',
        fileSize: 'number',
        urlName: 'string',
        clientId: 'number',
        status: 'string',
        id: 'string'
    },
    downloadUrl: null,
    uploadUrl: null
});

and I need to set id in Algebra something like this:

const attachmentsAlgebra = new set.Algebra(
    set.props.id('attachmentTo.id')
);

but it doesn't work, could someone help how I have to set id in Algebra?

Nico R.
@nriesco
@kaderiho I don't know much about algebra but first check the case of attachmentTO (the last letter)
kostya.aderiho
@kaderiho
:)
I should be TO of course, fixed for not confusing
Kevin Phillips
@phillipskevin
if that did not solve your problem, please open an issue
kostya.aderiho
@kaderiho
but with TO doesn't work so far :(
Kevin Phillips
@phillipskevin
I'm not sure if using nested properties is supported
so we may need to add this as an enhancement
kostya.aderiho
@kaderiho
could you please say where I can write about this issue?
Kevin Phillips
@phillipskevin
kostya.aderiho
@kaderiho
I mean for guys who work on canjs
okey, many thanks
Nico R.
@nriesco

I have a component that looks like this:

export default Component.extend({
  tag: 'my-tag',
  ViewModel,
  view,
  events: {
    inserted: function() {
      console.log('this works!');
    }
  }
});

and will show 'this works!' in the console. I tried to guess other events such as 'resize', 'onresize', etc.. but none of them workded. How can I know for sure what are the possible events that will be triggered? somehow I know 'inserted' is available, but what about the rest?

Thanks

BTW: I’m trying to detect an element resize event (a div for example). A Window resize won’t work because I need the real width of the element that depends on several show/hidden blocks
Gregg Roemhildt
@roemhildtg
Are you sure elements actually dispatch resize events? I thought that was only on the window object.
Nico R.
@nriesco
I don’t know who triggers the “inserted” event, nor what other events could be triggered.
I can trigger a click event, that works
maybe the approach is totally wrong, but still there must be a list of events that can be used there
Gregg Roemhildt
@roemhildtg
Yep, I was just going to link that page. I think for the most part, that events block is just for inserted removed and viewmodel listeners. Like {viewModel} propertyName to listen for when propertyName changes
Nico R.
@nriesco
I think I might have an idea..
ok this works
export default Component.extend({
  tag: 'my-tag',
  ViewModel,
  view,
  events: {
    inserted: function(el) {
      $(window).on('resize', function() {
        console.log('this works too!!!');
      });
    }
  }
});
thanks @roemhildtg
Nico R.
@nriesco
one question thought...
the $(window)… part.. is that jQuery? this is a donejs project and I never imported jQuery… but it works, weird isn’t it?
Gregg Roemhildt
@roemhildtg
jQuery gets imported by some package. I think can-connect might import it. You can npm ls jquery to see which one is requiring it I think
Matthew Phillips
@matthewp
If it's a DoneJS 1.0 app then jquery is not included by default.
if you installed can-jquery that might be why.
Nico R.
@nriesco
thanks again @roemhildtg npm ls jquery shows this (that explains it):
├─┬ bootstrap-datepicker@1.6.4
│ └── jquery@3.2.1
├─┬ documentjs@0.5.0
│ └── jquery@1.11.3
└─┬ funcunit@3.3.0
  └── jquery@1.11.0
Matthew Phillips
@matthewp
So if you are using that bootstrap datepicker, it probably is coming from there.
Nico R.
@nriesco
@matthewp I don’t understand why is jquery available in this case. If I don’t use bootstrap-datepicker then jquery won’t be available at all? if it is imported using progressive loading will it still be available even if that module is not yet imported?
I guess the correct way to use jquery is to import it in the project and don’t rely on other components importing it.. what brings the next question.. if I import version 2 and bootstrap-datepicker is importing version 3, then what version will be really available?
Matthew Phillips
@matthewp
That's right, if you don't use something that uses jQuery then it won't be available on the window.