Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : can.Component vs Polymer

$
0
0
Speed.  can.Component doesn't polyfill the entire DOM.
Browser support.  can.Component works in IE8.
V-VM can.Component is more or less about connecting a viewModel to a live view.   A simple polymer custom element doesn't really provide that.

That said, I think polymer is very cool technology.  But web components have a long way to go before they land in enough browsers to make them useful.  And after seeing what's happened with ES6 modules, they could look very different by that time.  I'd very much like to make can.Component's be useful as normal elements ... making something like document.createElement('some-component') work.  However, a HUGE issue is how does the view's scope work in these scenarios.  This is something I've asked many people about, without a good answer.

can.Component does not currently allow you to extend.  There's a pull request for this, but it's not, imo, super useful because most of the logic of a component should be in its view model.  And you can easily extend a view model and pass it to another component:

BaseViewModel = can.Map.extend({ ....})


  1. can.Component.extend({
  2.   tag: 'tag-1'
  3.   viewModel: BaseViewModel.extend({ ...})
  4. })

  5. can.Component.extend({
  6.   tag: 'tag-2',
  7.   viewModel: BaseViewModel.extend({ ... }
  8. })




Viewing all articles
Browse latest Browse all 3491

Trending Articles