Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 15 18:40
    lateshift starred canjs/canjs
  • Sep 13 21:53
    chasenlehara closed #5207
  • Sep 13 21:28

    chasenlehara on major

    Update dist for release (compare)

  • Sep 13 21:28

    chasenlehara on v6.0.0-pre.14

    Update dist for release 6.0.0-pre.14 (compare)

  • Sep 13 21:22

    chasenlehara on 5207-remove-can-define

    (compare)

  • Sep 13 21:22

    chasenlehara on major

    Remove can-define usage in CanJ… (compare)

  • Sep 13 21:22
    chasenlehara closed #5282
  • Sep 13 21:08

    m-mujica on playlist

    WIP: Upgrade playlist editor to… (compare)

  • Sep 13 20:19
    m-mujica commented #5119
  • Sep 13 17:36
    m-mujica edited #5119
  • Sep 13 17:15
    m-mujica edited #5119
  • Sep 13 16:34
    chasenlehara review_requested #5282
  • Sep 13 16:34
    chasenlehara review_requested #5282
  • Sep 13 16:33
    chasenlehara ready_for_review #5282
  • Sep 13 15:04

    greenkeeper[bot] on webpack-4.40.2

    (compare)

  • Sep 13 14:47

    greenkeeper[bot] on webpack-4.40.2

    chore(package): update webpack … (compare)

  • Sep 13 14:36
    chasenlehara synchronize #5282
  • Sep 13 14:36

    chasenlehara on 5207-remove-can-define

    Remove can-define usage in CanJ… (compare)

  • Sep 13 13:56
    chasenlehara synchronize #5282
  • Sep 13 13:56

    chasenlehara on 5207-remove-can-define

    Remove can-define usage in CanJ… (compare)

Roger K
@thejavascriptist
ok.
thanks much @phillipskevin ... testing can map shortly
Kevin Phillips
@phillipskevin
this is the epic for 4.0: canjs/canjs#3140
you can get the change event with DefineMap by serializing it
did you try that first?
var routeCompute = compute(function() {
  return route.data.serialize();
});

routeCompute.on('change', function() { ... });
Roger K
@thejavascriptist
trying routeCompute first
Roger K
@thejavascriptist

@phillipskevin got route.map to work... on gotcha for someone trying it out...

route.data.on('change', function() { ... });

must come before the

route.ready();
Looked into samples from api 2.x docs to get it working...
the 3.x docs need some love for first time users...
Frank Lemanschik
@frank-dspeed
@thejavascriptist i am working on that and i can tell you at present the whole canjs documentation is based on the suggestion that you look into the Guide as first time user
if you jump over that step your missing a lot of needed infos thats only documented in the biginners guide
Frank Lemanschik
@frank-dspeed
@phillipskevin if you got a secund can you explain why you did "removing production tests for now"?
kostya.aderiho
@kaderiho
Hey guys, I have the next situation: I need to fire an event in parent component (click on button) and child component needs to listen this event and do smth on this. So which is the best solution for implementing this? In old canjs (2.2.0) I used viewModel.dispatch method, but not aware that it works by the same way in 3.9.0. Thanks in advance!
Kevin Phillips
@phillipskevin
@frank-dspeed because they were breaking and I wanted to make a pre-release
I did that on the minor branch, just to be clear
@kaderiho the best way is to use data binding
click a button -> change a property on the viewModel -> pass that property to the child component
you can use https://canjs.com/doc/can-event.html, but it's a much harder pattern to write tests for
Frank Lemanschik
@frank-dspeed
@phillipskevin ah ok tought this was done to remove the tests also for release :)
Kevin Phillips
@phillipskevin
no, just don't want to take the time to figure out which dependency is breaking the production tests
we will fix that before anything is released
kostya.aderiho
@kaderiho
@phillipskevin thanks man, I will try it
Roger K
@thejavascriptist
@frank-dspeed thanks, re: the guides... A longer term ask would be to see guides which are more than samples running in jsbin. e.g. with best practices recommended by the can team etc. one example to look into is https://github.com/gothinkster/realworld This would also help people like me sell canjs to my managers and bring better awareness of canjs and donejs out.
Kevin Phillips
@phillipskevin
that's a good suggestion
longer examples are difficult since a lot of people won't spend that much time going through them
all of the donejs guides are bigger apps though
this one in particular: https://donejs.com/bitballs.html
a lot of the newer guides are focused more on new users, and not as much on selling to CTOs, etc
but we should try to accomplish both
obviously
Yeswanth Raghav T
@tyraghav

Hi All
I have a can.component element with tag person

<person {(mydetails)}="details"></person>
Where details is a can.model type
Where should I declare mydetails model in can.component in order to get the values of details to mydetails..??
In viewmodel or As seperate variable in can.component or Inside define...??
How should I declare it..??
My can.component is like this
Can.component.extend({
tag:'person',
template:can.stache("<h1>{{rollno}}<h1><h2>{{Data}}<h2>"),
viewModel:{
rollno:"111111",
Data:"111111="+mydetails.name
}});

The above one is not working
Can anyone please help me by letting me know how this could be done or can anyone please provide me the above can.component ?
I am new to can js.
Anyone please help

I am using can 2.3 version
Kevin Phillips
@phillipskevin
it should be part of the viewModel of the component
James Atherton
@James0x57
viewModel: {
  define: {
    Data: {
      get: function () {
        return "11111=" + this.attr("mydetails.name");
      }
    }
  },
  ...
}
Yeswanth Raghav T
@tyraghav
The above code is giving a error mydetails is not defined
James Atherton
@James0x57
you can add a "mydetails" property to your viewModel as well. But if you are passing it in to your person component:
<person {(mydetails)}="details"></person>
then it should be defined as whatever "details" is in the parent
Yeswanth Raghav T
@tyraghav
I can't get you
James Atherton
@James0x57
where are you including this code: <person {(mydetails)}="details"></person>?
Yeswanth Raghav T
@tyraghav
In some other statche
James Atherton
@James0x57
that other stache has a viewModel of its own, yeah?
Yeswanth Raghav T
@tyraghav
details is a model type which is like this
No
I am invoking the other statche from a can.control.extend type
James Atherton
@James0x57
viewModel: {
  define: {
    Data: {
      get: function () {
        return "11111=" + this.attr("mydetails.name");
      }
    },
    mydetails: {
      value: new DetailsModel()
    }
  },
  ...
}
Yeswanth Raghav T
@tyraghav
Thank you very much
It is working great
James Atherton
@James0x57
:beers: no problem :)
Yeswanth Raghav T
@tyraghav
If I want to use the value of Data inside a function in view model, how can I use it..??
Kevin Phillips
@phillipskevin
this.Data