These are chat archives for canjs/canjs

9th
Oct 2015
Aggelos Karalias
@mehiel
Oct 09 2015 17:45
Any plans on moving away from can.Construct in favor of ES6 classes, decorators, etc?
Is it even possible?
Matthew Phillips
@matthewp
Oct 09 2015 18:47
all of that is planned
I believe es5 getters/setters already works
but when we'll move to all of that i'm not sure, probably 3.0
we're a little conflicted about es6
because we don't want to force users into transpiling
@justinbmeyer with can-connect is it possible to pass in jQuery ajax options?
looks like it might be possible with data-url
url: { crossDomain: true } maybe
i'll try that
Matthew Phillips
@matthewp
Oct 09 2015 18:57
No, those options are not passed to jquery
i would where the best place would be to put those options
here's my suggestion canjs/can-connect#40
Aggelos Karalias
@mehiel
Oct 09 2015 19:43
@matthewp thanks.. the argument on forcing transpiling is strong for sure..
Justin Meyer
@justinbmeyer
Oct 09 2015 20:02
@mehiel Can you not use them already?
everything can.Construct produces is a normal JS function
complete w/ a prototype
I think the only problem would be using constructor instead of init
oh
I guess there wouldn't call .extend
which might be a problem
Aggelos Karalias
@mehiel
Oct 09 2015 20:06

Can you point me to an example? What I'm looking for here is if there is any plan (or way) to move from something like:

var MyComponent = Component.extend(...)

to something like:

@Component
class MyComponent ...
Justin Meyer
@justinbmeyer
Oct 09 2015 20:06
have you tried
class MyComponent extends can.Component { ... }
that will probably not work
the problem is that I don't think there's an "extension" hook
which is needed in many of CanJS's constructs
for example, when a component is extended, it registers its name
its tag I mean
You'd have to do:
class MyComponent extends can.Component { ... }
MyComponent.setup()
probably
that code needs to run when a component is created
it's subComponent needs to be setup ... it's sub can.Map .... it's template processed ... and the component registered on can.view.tag
too bad class doesn't have some sort of callback for when the function is extended
if there was (or is), we could make it work pretty easily
Justin Meyer
@justinbmeyer
Oct 09 2015 20:11
worst case, you always have to call some sort of .setup() method after extension
we could probably do a lot of this the first time an instance of that map was initialized
So maps could probably be made to work this way pretty easily
@mehiel if you'd like to see this, please create an issue
and link back to this conversation
Aggelos Karalias
@mehiel
Oct 09 2015 20:17
I will.. I want to try to find out what's in there in ES6 decorators as well and if they provide any extension hook which would do the .setup() stuff..
@justinbmeyer btw I patched Map today following your "Paper Solution" on bitovi/canjs#1322 and it works as expected.. you just missed a return in the twoLevelDeepExtend method..
Justin Meyer
@justinbmeyer
Oct 09 2015 20:20
awesome! can you submit a pull request?
Aggelos Karalias
@mehiel
Oct 09 2015 20:20
yp
first thing tomorrow
Matthew Phillips
@matthewp
Oct 09 2015 20:23
decorators is not an es6 feature
and i believe not even accepted as a feature at all
Aggelos Karalias
@mehiel
Oct 09 2015 20:29
hmmm.. true.. seems like it's under discussion for ES.later (probably 7)..
Matthew Phillips
@matthewp
Oct 09 2015 20:31
we should change the Map setup behavior
it's the reason why can is not live-reloadable
can't we just do if(this === Map) there?