# Help understanding code

**URL:** <https://forums.bitovi.com/t/help-understanding-code/765>\
**Category:** DoneJS\
**Created:** [November 24, 2017, 7:30am UTC](https://forums.bitovi.com/t/help-understanding-code/765 "2017-11-24T07:30:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nriesco](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nriesco/32/190_2.png) [@nriesco](https://forums.bitovi.com/u/nriesco)\
**Post date:** [November 24, 2017, 7:30am UTC](https://forums.bitovi.com/t/help-understanding-code/765/1 "2017-11-24T07:30:30Z")

</div>

I was reading this: [https://donejs.com/Features.html#custom-html-elements](https://donejs.com/Features.html#custom-html-elements) + [https://jsbin.com/xutupo/2/edit?html,output](https://jsbin.com/xutupo/2/edit?html,output) and got really curious about the code in there:

```auto
<order-model get-list="{ period='previous_week' }" value:to="*previousWeek" />
<order-model get-list="{ period='current_week' }" value:to="*currentWeek" />

<bit-c3>
  <bit-c3-data>
    <bit-c3-data-column key="Last Week" value:from="*previousWeek.totals" />
    <bit-c3-data-column key="This Week" value:from="*currentWeek.totals" />
  </bit-c3-data>
</bit-c3>

```

There were two things I couldn’t quite understand:

1. `get-list="{ period='previous_week' }"` what is `get-list` and what is that strange syntax on the right side? is it an object? if so does it mean I could have `my-function-name="{ param1=this.var1 param2=this.var2}"`?
2. the use of `*` in the binding: I think it was previously explained to me that it had to do with some sort of “temporal” element to connect both the `order-model` with `bit-c3-data-column` without using a real property. There is an explanation here [https://canjs.com/doc/can-stache-bindings.reference.html#Use](https://canjs.com/doc/can-stache-bindings.reference.html#Use) but still I barely understand how to use it and its benefits.

Thanks

---

<div class="post-metadata">

**Author:** ![chasen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/chasen/32/402_2.png) [@chasen](https://forums.bitovi.com/u/chasen)\
**Post date:** [December 5, 2017, 10:36pm UTC](https://forums.bitovi.com/t/help-understanding-code/765/2 "2017-12-05T22:36:18Z")

</div>

Hi @nriesco, sorry it took so long to get a response!

1. `get-list` is something special to `can-connect`, so it’s not a thing you can use elsewhere. You can see its code here: [https://github.com/canjs/can-connect/blob/6ebbf416eb3e1c58475e9971c557b9e937970328/can/tag/tag.js#L74](https://github.com/canjs/can-connect/blob/6ebbf416eb3e1c58475e9971c557b9e937970328/can/tag/tag.js#L74)

You can use [hash expressions](https://canjs.com/doc/can-stache/expressions/hash.html) to make something like `on:click="myFunction(param1=var1 param2=var2)"` call `myFunction({param1: var1, param2: var2})`

1. `*` (in CanJS 3) can be used to take a value from a child component and make it usable elsewhere in the template. You can always do that by creating a property in the template for the view model, but with `*` you don’t have to create that extra property. These docs have a little more info: [https://canjs.com/doc/can-stache-bindings.toParent.html#ExportingViewModelproperties](https://canjs.com/doc/can-stache-bindings.toParent.html#ExportingViewModelproperties)

We’re deprecating the `*` syntax in CanJS 4 so that it’s more clear what’s going on. You can start using [scope.vars](https://canjs.com/doc/can-stache/keys/scope/scope.vars.html) to accomplish the same thing in can-stache 3.11+

Hope that helps,  
Chasen

---

<div class="post-metadata">

**Author:** ![nriesco](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/nriesco/32/190_2.png) [@nriesco](https://forums.bitovi.com/u/nriesco)\
**Post date:** [December 17, 2017, 8:43am UTC](https://forums.bitovi.com/t/help-understanding-code/765/3 "2017-12-17T08:43:13Z")

</div>

Thanks a lot @chasen

Just to be sure, this `<order-model get-list="{ period='previous_week' }" value:to="*previousWeek" />` is equivalent to have a getter in the viewmodel that calls the `getList` method (returns a Promise) with params defined as `{ period='previous_week' }` ?

---

<div class="post-metadata">

**Author:** ![chasen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.bitovi.com/chasen/32/402_2.png) [@chasen](https://forums.bitovi.com/u/chasen)\
**Post date:** [December 23, 2017, 2:37am UTC](https://forums.bitovi.com/t/help-understanding-code/765/4 "2017-12-23T02:37:04Z")

</div>

Yup, that seems right to me!
