Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:45
    greenkeeper[bot] labeled #5387
  • 12:45
    greenkeeper[bot] opened #5387
  • 12:45

    greenkeeper[bot] on can-stache-element-1.0.2

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

  • 09:49
    chasenlehara edited #5384
  • 09:47
    chasenlehara edited #3864
  • 09:46
    chasenlehara edited #5383
  • Oct 17 20:12

    matthewp on master

    Update dist for release (compare)

  • Oct 17 20:12

    matthewp on v6.1.2

    Update dist for release 6.1.2 (compare)

  • Oct 17 20:04

    matthewp on master

    Update dist for release (compare)

  • Oct 17 20:04

    matthewp on v6.1.2-0

    Update dist for release 6.1.2-0 (compare)

  • Oct 17 19:17
    akbaruddin starred canjs/canjs
  • Oct 17 17:25
    matthewp edited #5384
  • Oct 17 17:00

    matthewp on can-dom-mutate-2.0.7

    (compare)

  • Oct 17 17:00

    matthewp on master

    fix(package): update can-dom-mu… Merge pull request #5386 from c… (compare)

  • Oct 17 17:00
    matthewp closed #5386
  • Oct 17 16:27
    greenkeeper[bot] labeled #5386
  • Oct 17 16:27
    greenkeeper[bot] opened #5386
  • Oct 17 16:27

    greenkeeper[bot] on can-dom-mutate-2.0.7

    fix(package): update can-dom-mu… (compare)

  • Oct 17 16:25

    matthewp on can-dom-mutate-2.0.6

    (compare)

  • Oct 17 16:24
    matthewp closed #5379
Aggelos Karalias
@mehiel
if I apply this patch it does work but as I'm not really aware of that Refs concept in Scope I'm not sure if that breaks something else..
@@ -537,7 +537,7 @@

         var viewModel = can.viewModel(el);
         var scope = new can.view.Scope(viewModel);
-        var refs = attrData.scope.getRefs();
+        var refs = attrData.scope.getViewModel();

         var computeData = scope.computeData(prop, {
         args: [],
Andrei Balmus
@abalmush

Gusy, please help: Is it possible to set current context to a custom attribut of the Component? just Like this:

{{#products}}
    <product productdata={{.}}></product>
{{/products}}

inside product Component I’m getting ‘[object Object]’ :(

oh forgot to tell you, I’m using stache
Aggelos Karalias
@mehiel
@abalmush try productdata="{.}"
Andrei Balmus
@abalmush
@mehiel ok thanks!
Andrei Balmus
@abalmush
@mehiel, {.} doesnt work for me, it’s just renders ‘{.}'
I just created jsfiddle to test: https://jsfiddle.net/ghdc74gx/
Aggelos Karalias
@mehiel
that's because of prod: '@'
can you remove that and try again
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