These are chat archives for canjs/canjs

19th
Apr 2017
Viktor Busko
@Lighttree
Apr 19 2017 09:52
Is there any way to use JSON as attribute value in such case:
<my-app my-data="{key: value, key: value}"></my-app>
It doesn't appear in VM if i use this
I can wrap it to quotes, so it will be treated as string, but maybe there is another way
Justin Meyer
@justinbmeyer
Apr 19 2017 16:32
@Lighttree did you try using hash expressions ?
<my-app my-data="key =value key2=value"></my-app>
you could always create a helper / method that would do this too
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:17
after update node modules I got Uncaught ReferenceError: setImmediate is not defined on proto-compute
Kevin Phillips
@phillipskevin
Apr 19 2017 17:18
thanks @cherifGsoul, we’ll fix this
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:19
thank you @phillipskevin
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:19
I'll get on that.
(because I broke it)
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:20
@bmomberger-bitovi tomorrow I have presentation :D
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:20
@cherifGsoul what platform did you see that on?
Kevin Phillips
@phillipskevin
Apr 19 2017 17:20
I added a comment @bmomberger-bitovi
we just need to use the one from can-util
sorry I didn’t catch that before you merged
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:20
Ah, of course.
That's what I was missing.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:20
@bmomberger-bitovi platform you mean node?
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:20
Right. That.
This will be quick. I'll let you know as soon as it's out.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:21
I have node 5.12.0
thank you
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:35
@bmomberger-bitovi it's fixed thank you
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:36
You're welcome. I still have to update can-stache-bindings because I was referencing the broken can-compute there, but that's in process now.
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 19 2017 17:36
cool
Kevin Phillips
@phillipskevin
Apr 19 2017 17:38
it should get the latest because of semver, right @bmomberger-bitovi ?
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:39
Our version specs for anything not canjs/canjs use ^ which means any patch or minor after the specified one is acceptable.
Kevin Phillips
@phillipskevin
Apr 19 2017 17:40
right, so can-stache-bindings wouldn’t be broken if you re-installed node_modules
I agree it’s still better to update it
it just shouldn’t block @cherifGsoul
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 17:40
There you go.
NPM versioning mastery is not among my many talents, which is why I rely on my Bitovian colleagues for guidance.
Justin Meyer
@justinbmeyer
Apr 19 2017 18:05
@bmomberger-bitovi sorry about missing that
I sorta assumed it was require-ed
Eben
@eben-roux
Apr 19 2017 18:52
spotted something odd in the docs but when I click on the "Edit on GitHub" link I get a 404: https://github.com/canjs/canjs/edit/master/node_modules/can-define/list/list.js#L894
Kevin Phillips
@phillipskevin
Apr 19 2017 18:57
can you submit an issue for the broken “Edit on GitHub” link also?
with where you saw it
Eben
@eben-roux
Apr 19 2017 19:05
sure
btw... I'm upgrading to v3.0 and was using delegate in v2.3. Is this still around or is there some other way to do the same thing?
Kevin Phillips
@phillipskevin
Apr 19 2017 19:07
which issue?
logging it there is fine… we can move it if needed
http://canjs.com/doc/can-event.delegate.html is what you’re looking for I think
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 19:09
If you import can-jquery does that then delegate as expected?
Eben
@eben-roux
Apr 19 2017 19:17
issue logged... and I'll give that delegate a go, thanks!
well, I'm trying to remember why I used the delegate since I haven't looked at this code for some time.
I have a suspicion it had to do with route changes that weren't firing correctly when using the Map directly
the delegate would work as expected
I think that in the handling of the event I was also, at times, changing the route values
Justin Meyer
@justinbmeyer
Apr 19 2017 19:31
@eben-roux there is no more delegate on observables
instead of delegate, just us a computed property and listen to when that changes
Eben
@eben-roux
Apr 19 2017 19:32
ah... makes sense
Justin Meyer
@justinbmeyer
Apr 19 2017 19:46
or use can-define-stream
Ranjan Subbiah
@ranjanbuilds
Apr 19 2017 20:16

I'm using define map for the following:

 "selection": {
          'name': null,
          'associated_IDs': [],
          get common_associated_IDs() {
            return this.name;
          },
        }

but when I set name:

this.default_selectors[selectorIndexNum].set({
                    selection: {
                      name: selectorOption.name,
                      associated_IDs: selectorOption.associated_IDs
                    }
                  });

and call common_associated_IDs

this.viewModel.default_selectors[0].selection.common_associated_IDs

I still get null

Kevin Phillips
@phillipskevin
Apr 19 2017 20:59
can you put an example in JSBin?
there’s a link at the top of gitter you can use as a starter
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 21:01
Is your first snippet a definition (i.e., is that part of an object you're passing into DefineMap.extend())?
Ranjan Subbiah
@ranjanbuilds
Apr 19 2017 21:57
@phillipskevin will do when I get a minute, thanks
@bmomberger-bitovi yes passing into DefineMap.extend()
Brad Momberger
@bmomberger-bitovi
Apr 19 2017 23:43
OK, so when you want to define a property on a DefineMap as being a DefineMap with its own known properties, then you need to use the type specifier (or Type), rather than directly giving it property values.
So your selection property will look like this:
 "selection": {
     "type": {
          'name': { 'value': null },
          'associated_IDs': { 'Value': DefineList },
          get common_associated_IDs() {
            return this.name;
          }
        } 
    }
You can tweak the type and value and getter/setters for each sub-property as needed. They work the same as the containing object, so value is necessary for initial values
If you want the selection to also be initialized, you can then initialize it with value: {}along with the type def.