These are chat archives for canjs/canjs

6th
Apr 2018
Viktor Busko
@Lighttree
Apr 06 2018 16:00

Guys, we found some critical issue in IE11 it seems to be valid for CanJS 4+ and DoneJS 2.

We are using CanJS4+ with Webpack and got some missed API in IE11 like Object.assign
We added core-js as lib with polyfills (it is used by Babel as well.) and had to add polyfills for object, weak-set and map.
As result we still having and issue: 'Incompatible receiver, map required!'
It seems that it fails somehow when works with canjs, not sure how.
I've tried to use babel-polyfill, but internally it uses core-js, so result is the same.

I was thinking that something wrong with our setup, so I tried to create new DoneJS 2 app and it throws issue about Object.assign as well, I believe if we fix this issue we will go through the same sequence of issues and end with 'Incompatible receiver, map required!'. (I tried to add core-js polyfills to app.js in donejs app but it doesn't help to fix even Object.assign issue in some reason)

Maybe someone know the reason ? Is this is known bug ?

Chasen Le Hara
@chasenlehara
Apr 06 2018 17:02
Hi @Lighttree, we’re only testing CanJS 4 in Edge and not IE 11.
You can see what the test suite runs here: https://github.com/canjs/canjs#canjs
Chasen Le Hara
@chasenlehara
Apr 06 2018 17:10
We’re open to adding support for IE11, it just hasn’t been a priority because none of our projects have required it and this is the first time it’s come up. 🙂
What’s throwing the Incompatible receiver, map required! error?
I think IE 11 has basic support for Map, so a polyfill shouldn’t be required for it.
Pestdoktor
@Pestdoktor
Apr 06 2018 19:02
here's the error on a fresh 'donejs add app' + babel-polyfill:
Eben
@eben-roux
Apr 06 2018 19:26
hello, I'm trying to add some bootstrap javascript when a component is inserted but the "inserted" event doesn't seem to fire
any advice on the best way to pick up when a component is added to the DOM?
Pestdoktor
@Pestdoktor
Apr 06 2018 19:34
are you using canjs 4?
The inserted and removed events, most commonly used in can-components are no longer included.
Eben
@eben-roux
Apr 06 2018 19:34
thought as much... thanks, I'll have a look
thanks a stack... that did the trick
Eben
@eben-roux
Apr 06 2018 19:40
do you know how I would get the viewModel in that method?
pffft... nevermind
"this"
Chasen Le Hara
@chasenlehara
Apr 06 2018 19:44
@Pestdoktor Is that with the Map polyfill? Does it work without it?
Pestdoktor
@Pestdoktor
Apr 06 2018 19:49
without any polyfill it complains about missing assign method: https://hastebin.com/raw/oricomajak
Justin Meyer
@justinbmeyer
Apr 06 2018 20:36
@Lighttree I think something like Context API is a foot-gun ... it makes things simple at first, but difficult to reuse and test later.
I think it's better to at least pass the "global" state ... you can always do: <sub-component state:from="this"> where this is your global state. By passing, you at least allow someone to pass a different state value.
Justin Meyer
@justinbmeyer
Apr 06 2018 20:43
I've also thought about supporting object (or hash) so you can select what actually gets put into state:
<sub-component state:from="{propA, probB: valB}">
Justin Meyer
@justinbmeyer
Apr 06 2018 20:58
canjs/can-stache#505