These are chat archives for canjs/canjs

20th
Apr 2016
Mason Shin
@minsooshin
Apr 20 2016 00:04
can anyone answer this question?
import Map from ‘can/map/‘;
Is this overwrite the native ES6 object?
Map object
Kevin Phillips
@phillipskevin
Apr 20 2016 00:20
not overwrite, but in your module Map will be can.Map
outside of that module Map will still be the native Map
Mason Shin
@minsooshin
Apr 20 2016 00:21
So If I use both in the module, what happen?
I cannot use both in a same module, right?
Kevin Phillips
@phillipskevin
Apr 20 2016 00:21
you just need to name can.Map something else
import CanMap from ‘can/map/‘;
Mason Shin
@minsooshin
Apr 20 2016 00:21
oh…
got it
thanks
Kevin Phillips
@phillipskevin
Apr 20 2016 00:21
no problem
Mason Shin
@minsooshin
Apr 20 2016 00:22
import can.Map from ‘can/map/‘;
does it work? or I should do this?
import can from ‘can’;
to use can.Map
Kevin Phillips
@phillipskevin
Apr 20 2016 00:27
the first one won’t work
Mason Shin
@minsooshin
Apr 20 2016 00:27
got it
Kevin Phillips
@phillipskevin
Apr 20 2016 00:27
it’s just like naming a variable
Mason Shin
@minsooshin
Apr 20 2016 00:28
okay
Kevin Phillips
@phillipskevin
Apr 20 2016 00:28
you can do import CanMap from ‘can/map/‘;
Mason Shin
@minsooshin
Apr 20 2016 00:28
yes
I think that is the best way to avoid import entire library
not in the component
Andrei Balmus
@abalmush
Apr 20 2016 11:53
Guys I would like to use CanJS in an exisiting application with SystemJS, and I’m getting the folowing error:
Uncaught ReferenceError: steal is not defined
tostercx
@tostercx
Apr 20 2016 12:41
Hey, I think I found a bug in can-interrupt, but the repo isn't getting much attention. Maybe some dev could take a look? canjs/can-interrupt#4
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 12:42
@abalmush is stealjs used?
tostercx
@tostercx
Apr 20 2016 12:42
No...
Ah, sry
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 12:43
:)
Andrei Balmus
@abalmush
Apr 20 2016 12:50
@cherifGsoul no StealJS on this project :)
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 12:51
you may check if it is used somewhere in the app
Andrei Balmus
@abalmush
Apr 20 2016 12:52
Well, I just including CanControl like this: import CanControl from ‘can/control’;
no steal js in the project, if I uninstal can js everything looks good
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 12:53
so configure SystemJS to load canjs from node_modules/can/dist
you have CJS, STEAL and AMD version
Andrei Balmus
@abalmush
Apr 20 2016 12:55
yep, I’m installing CanJS using jspm and JSPM adding it to the map, I’m not sure what should I do more to tell SystemJS to load it from node_modules/can/dist @cherifGsoul
map: {
    "can": "npm:can@2.3.23”,
…
}
`
should I change it to
map: {
    "can": "npm:can@2.3.23/dist”,
…
}
?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 12:58
Im not very familiar with SystemJS, but check if it works like you did or check https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#paths configuration
@abalmush you can add stealjs to the app
it uses systemjs
Andrei Balmus
@abalmush
Apr 20 2016 13:01
@cherifGsoul do you mean replace it with SystemJS?
I mean Replace SystemJS to Steal
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 13:02
you replace nothing just configure system in the package.json
and make the build
it works fine with canjs without extra configuration
if the app is written in CJS or ES6 it will work fine
Matthew Phillips
@matthewp
Apr 20 2016 13:51
@abalmush I think your jspm config should be npm:can@2.3.23/dist/cjs
Andrei Balmus
@abalmush
Apr 20 2016 14:27
@matthewp thank you, tried this it wont work for some reasonce and also if I remove and install canjs again the jspm put npm:can@2.3.23 back :(
@cherifGsoul Yes I can change it, but I beleave it would be great to support different loaders CanJS will get more users, will be more popular
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 14:30
@abalmush yes this feature is on discussion in this issue canjs/canjs#2374
Andrei Balmus
@abalmush
Apr 20 2016 14:30
I like CanJS, but other fron end developers from our team dont like it because of issues with other loaders and also not enought docuemntation :worried:
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 14:31
you mean the official docs are not enough for them?
Matthew Phillips
@matthewp
Apr 20 2016 14:31
@abalmush I believe you can put config into a different file that will not be replaced when doing a jspm install
Andrei Balmus
@abalmush
Apr 20 2016 14:33
@cherifGsoul yeah they always talk about small community and quite insufficient documentation, I’m always reading comments in the code, so I understand everything
thank you @matthewp, I’ll try this
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 14:33
:worried:
Andrei Balmus
@abalmush
Apr 20 2016 14:34
So we have moved some project to React + Redux :worried: :worried:
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 14:35
So they are happy with just the view part :/
Andrei Balmus
@abalmush
Apr 20 2016 14:36
Yeah React as a view part and Redux as controller I believe, If I move to these projects I will need to learn Redux :worried:
and React as well
Matthew Phillips
@matthewp
Apr 20 2016 14:36
yuck
Andrei Balmus
@abalmush
Apr 20 2016 14:36
Dont like Redux
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 14:37
maybe they can use can-connectfor the model part :D
Andrei Balmus
@abalmush
Apr 20 2016 15:29
@cherifGsoul thats interesting, I see big problems with React when we need to attache behaviour to an exisitng DOM, so it’s easy with CanJS to create a Control, but how to do same thing with React? :)
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 15:30
@abalmush I have never used React
Matthew Phillips
@matthewp
Apr 20 2016 15:31
@abalmush You do this
rm -rf react-app/

donejs add app donejs-app
Mohamed Cherif Bouchelaghem
@cherifGsoul
Apr 20 2016 15:31
:D
Andrei Balmus
@abalmush
Apr 20 2016 15:38
:smile:
@matthewp I will create a WIKI page in our milestone and name it "how to avoid problems with React” and insert there your suggestion, lol
Joe Crick
@joe-crick
Apr 20 2016 15:53
@tostercx I can take a look at the issue with can_interrupt. What did you find?
tostercx
@tostercx
Apr 20 2016 17:56
@joe-crick Well can-interrupt doesn't seem to play well with the router control, when the pushstate plugin is on (probably due to replacing can.route.batch?). When clicking a link, that changes multiple attributes in can.route I get multiple route changed events in the router control (if 2 attributes are removed on click, I get 2 calls for the old route and 1 to the new).
I managed to fix my particular problem (I just use it for the routes, commit attached to issue) by calling the original batch.start() and batch.stop() when can-interrupt applies the changes. I'm not that familiar with the inner workings of canjs so I decided not to make a pull request yet, since it may break something else...
tostercx
@tostercx
Apr 20 2016 18:23
Not really sure what the main difference is, can.batch does seem to process things in a similar way.
Julian
@pYr0x
Apr 20 2016 19:55
how does set.comparators.sort('sortBy')
Thomas Sieverding
@Bajix
Apr 20 2016 21:52
@abalmush Use a package override w/ SystemJS
jspm install can -o "{ directories: { lib: 'dist/cjs' }, main: 'can' }”