Redefining a Polmer element at runtime

61 views
Skip to first unread message

phil cleaver

unread,
Jul 20, 2015, 9:49:57 AM7/20/15
to polym...@googlegroups.com
Hi,

I'm writing an IDE for web components and I'm trying to find a way of changing the definition of a web component at runtime.  If I try to reregister the element I simply get a message that a component with this name already exists.

Is there a way to remove a web component definttion from the document so I can reload it?

Regards

Phil

Daniel Freedman

unread,
Jul 20, 2015, 2:48:21 PM7/20/15
to phil cleaver, polymer-dev
No component definitions are write-once for now (https://github.com/w3c/webcomponents/issues/152). There are ideas for v2 to have CustomElement registries exposed and modifiable, but no concrete proposals as far as I know.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/c51868db-5606-4ae7-ab5e-9bbb61a52f44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Fagnani

unread,
Jul 20, 2015, 2:58:10 PM7/20/15
to Daniel Freedman, phil cleaver, polymer-dev
One potential workaround I've thought of in the context of Polymer Designer, is to patch up Polymer() to be able to able to redefine elements - possibly by inserting an extra prototype in the prototype chain just about the instances, then on redefinition change that object's proto pointer to the new prototype and skip calling document.registerElement(). I'm not all all sure what might break if I did that, but I'm pretty sure something would. The fallback is to just reload the page, and try to serialize the important state in some way.

-Justin


Reply all
Reply to author
Forward
0 new messages