Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:43
    greenkeeper[bot] closed #5373
  • 14:43

    greenkeeper[bot] on can-deep-observable-1.0.1

    (compare)

  • 14:42

    m-mujica on update-deep-observable

    (compare)

  • 14:42

    m-mujica on master

    Update can-deep-observable to l… Merge pull request #5374 from c… (compare)

  • 14:42
    m-mujica closed #5374
  • 14:42
    m-mujica closed #5365
  • 14:09
    f-ricci starred canjs/canjs
  • 13:55
    greenkeeper[bot] commented #5375
  • 13:55

    greenkeeper[bot] on core-js-3.3.2

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

  • 10:51
    m-mujica review_requested #5374
  • 07:43
    rjgotten commented #5358
  • Oct 13 15:14
    greenkeeper[bot] commented #5375
  • Oct 13 15:14

    greenkeeper[bot] on core-js-3.3.1

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

  • Oct 13 14:49
    greenkeeper[bot] labeled #5375
  • Oct 13 14:49
    greenkeeper[bot] opened #5375
  • Oct 13 14:49

    greenkeeper[bot] on core-js-3.3.0

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

  • Oct 12 18:35
    matthewp commented #5358
  • Oct 12 18:15
    chasenlehara commented #5358
  • Oct 12 06:41

    greenkeeper[bot] on @octokit

    (compare)

  • Oct 12 06:39

    greenkeeper[bot] on @octokit

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

Andrei Balmus
@abalmush
sure one sec
yes it works now @mehiel thank you so much!!
Aggelos Karalias
@mehiel

from viewModel's doc

Prototype properties that have values of "@" are not looked up in the current viewModel

Andrei Balmus
@abalmush
allright, i used only string before so didnt have any issues, but now I need object and you save my life, thank you!
espretto
@espretto
quick question: would one produce zombie views if a components template changed? i have a large app which loads components only when needed and one parent component to manage that like so:
Component.extend({
    tag: 'oa-articles',
    leakScope: true,
    scope: {
      // articles: <model>,
      request: compute(function () {
        var scope = this;
        ArticleModel.findAll({
          categoryId: scope.attr('categoryId')
        }).then(function (articles) {
          scope.attr('articles', articles);
        });  
      })
    },
    events: {
      // request's dependency tracking for `categoryId` is only set-up when bound
      '{scope} request': function () {},

      '{scope} articles': function (ctx, evt, articles) {
        var $elem = this.element,
                tags = articles.pluck('tag');
        $.when(tags.map(function (tag) {
          return requestComponentByTag(tag);
        }).then(function () {
          $elem.html(tags.map(function (tag) {
            return '<'+tag+'></'+tag'>';
           }).join(''));
        });
      }
    }
  });
});
espretto
@espretto
i meant to write $elem.html(stache(tags.map(function (tag) { ... }).join('')));
Aggelos Karalias
@mehiel
@espretto I'm pretty confident that's not leaking.. .html() should call destroy in the included components.. I suppose a naive test is to create a destroy method in the events of an inner component and see if that's called when you replace stuff with .html()
Nezar Fadle
@nezarfadle
Hi guys , Is there any articles for newbie explain how to make the components globally available to the system and the other components as well :)
Jan Jorgensen
@ramblinjan
@nezarfadle could you give an example of what you're trying to do?
Nezar Fadle
@nezarfadle

Let's assume that I have a generic message component which is gonna display a simple message
with a title:

components/message/message.js
components/message/message.stache

var MessageModel = can.Map.extend({
title: "",
message: ""
});

can.Component.extend({
tag: 'message-widget',
viewModel: MessageModel,
template: can.view('/components/message/message.stache')
});

And I have another component called Order:

components/order/order.js
components/order/order.stache

I want the message component to be available to the order component and both of them available globally to the system or any other component calling them

dylanrtt
@dylanrtt
@nezarfadle you could make a "lib" module for example that imports all of the modules you want to be "global". Anything needing to use the message component for example could import "lib"
I'm not sure of a way to make them truly global since you would have to ensure they load first somehow
Nezar Fadle
@nezarfadle
Let me make it more clear ... In other words .. I wanna build a modular application, But I didn't know what is the right way to deal with the Modules Loader :'(
dylanrtt
@dylanrtt
Now I'm more confused... are you saying you don't know how to use a module loader? Which one are you using?
Nezar Fadle
@nezarfadle
I tried to use require.js, But I had no luck, And now I'm trying to play with steal.js, But there are too many stuff are not clear !!
Marshall Thompson
@marshallswain
@nezarfadle Have you gone through the getting started guide?
Nezar Fadle
@nezarfadle
Yes, But most of it just shows you how to build everything in on single page,, It doesn't show you how to build a modules and make them call and pass data to each other + The routing part is not that clear
dylanrtt
@dylanrtt
Passing data between modules in CanJS is usually done by passing data between Components in the template. You can even import your components in the template layer if you want. Simply importing them should register the custom tag for use.
Nezar Fadle
@nezarfadle
The problem the I'm coming from a PHP background ,, I'm just looking for example shows me how to do a very simple primitive modular app in the right way specially with Loading modules and routing :)
Any way .. I will try to do more research and I will see how .. because I feel that the problem in me ,, maybe I lack some knowledge,, Thanks guys ,, ^_^
@dylanrtt ,, tnx man .. I'm gonna take a look at it :)
dylanrtt
@dylanrtt
@nezarfadle here's are some examples of modular components with demo pages showing how they are used https://github.com/bitovi-components
place-my-order is designed to be a more complex example including more features like routing https://github.com/donejs/place-my-order
Nezar Fadle
@nezarfadle
@dylanrtt I will take a look at them ,, tnx man :+1: :+1:
Andrei Balmus
@abalmush
hey guys is there a way to writing Can.JS app with ES6?
Adam L Barrett
@BigAB
@abalmush You can use stealjs ( http://blog.bitovi.com/get-started-with-stealjs ) and then load can with es6 syntax
import can from ‘can’;
Andrei Balmus
@abalmush
great! Thank you @BigAB
Nezar Fadle
@nezarfadle

When I tried to install Steal and CanJS using Bower it didn't work perfectly, And after I made a bit of research I found out that I have to tell Bower to install a specific tag release that supports the new version of Steal.

Stuff like this must be mentioned in the documentation or better to be fixed :worried:

http://stackoverflow.com/questions/26388857/canjs-with-stealjs-0-3-0

Nezar Fadle
@nezarfadle
CanJS is gonna be more awesome if it has a command line tool to take care of generating, registering the components and ( routing if possible ) :smile:
Matthew Phillips
@matthewp
@nezarfadle We actually have a command line tool in the works, will release in about a month that helps with application initialization, has generators, etc.
Nezar Fadle
@nezarfadle
@matthewp thats's gonna be really awesome :smile:
Nezar Fadle
@nezarfadle

I wish you guys make a basic video covering this stuff for the newcomers to CanJS :

  1. How to build a basic modular app with two or three basic primitive components, Even just showing Home, Contatc Us, About

  2. How to do routing and load those component in a singale page with applying transitions

  3. Point out obviously that we need a modules loader like Steal or Requirejs
Aggelos Karalias
@mehiel
why is List.filter returning new can.List() instead of new this.constructor()?
That makes sense for List.map I suppose but filtering should return a list of the same prototype as the original. I'm I losing something?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Hello, how I can add additional params to my ajax request in can-connect? for example apikey for a public APi
Andrei Balmus
@abalmush
Is there any plans to move Can.js to ES6 code?
Mohamed Cherif Bouchelaghem
@cherifGsoul
@abalmush you can write canjs apps with ES6 already take a look at stealjs http://stealjs.com/
Andrei Balmus
@abalmush
Hi @cherifGsoul, yes I tried to use it, but i had some issues with gulp-babel transpile, maybe i did some mistakes on Gulp configuration. Do you have an example of the Can.js app structure with Steal.js and ES6 modules? Maybe some “skeletone" app or something, so I can try it?
Mohamed Cherif Bouchelaghem
@cherifGsoul
donejs http://donejs.com/ may help you it has generators and other stuffs
Andrei Balmus
@abalmush
cool, let me check this, thank you a lot!
Mohamed Cherif Bouchelaghem
@cherifGsoul
welcome
Mohamed Cherif Bouchelaghem
@cherifGsoul
@justinbmeyer how to overwrite parseListData?? this dosent work for me!!
export const characterConnection = connect([
        "constructor",
        "can-map",
        "constructor-store",
        "data-callbacks",
        "data-callbacks-cache",
        "data-combine-requests",
        "data-inline-cache",
        "data-parse",
        "data-url",
        "real-time",
        "constructor-callbacks-once",
        {
            parseListData: function(rawData){

                    return rawData.data.results;
            }
        }
        ],options);
the json response is like this
{
    "data": {
        "results": [
            {
                "id":1,
                "name":"Foo"
            },
            {
                "id":2,
                "name":"Bar"
            }
        ]
    }
}
Matthew Phillips
@matthewp
@mehiel sounds like a bug
Aggelos Karalias
@mehiel
@matthewp I thought so.. I've fixed that locally, I could easily open an issue/PR/etc
Aggelos Karalias
@mehiel

and another change I made today and I'd like to ask for that, is that I changed component.js:43 with:

// Define a control using the `events` prototype property.
if(this.prototype.events.prototype instanceof ComponentControl) {
  this.Control = this.prototype.events;
} else {
  this.Control = ComponentControl.extend( this.prototype.events );
}

and now I can truly extend Components like:

var ChildComp = ParentComp.extend({
  tag: 'child-comp',
  events: ParentComp.Control.extend({
    '.some-selector click': function(el, ev) {
      this._super();
      can.dev.log("Extra work from child component");
    }
  })
});
this seems really useful (at least to my use case).. Is there any other way to do it without that change? Every child component seems to replace parent's events instead of extending it..
Justin Meyer
@justinbmeyer
@cherifGsoul I think you need to do that in a behavior