Skip to content

Creating Elements

Daniel Busłowicz edited this page Oct 7, 2016 · 1 revision

Besides of a classical declarative way or using document.createElement, Polymer allows to use a fully imperative way. Typed Polymer goes more the factory way (MyComponent.create(...)). For now, however, TypeScript does not allow to dynamically cast a type.

Another problem is hinting arguments for factory/constructor (tried to make it work with passing constructor, no luck as well). If you have any suggestions, please do not hesitate to create an issue.

The factory method will trigger a factoryImpl method as an additional step in a lifecycle. To make it more ES6 class-like, Typed Polymer uses a constructor instead (still works the same as factoryImpl).

See examples.

Links

Similar projects (that I know of)

Clone this wiki locally