Polymer and globals

北城以北 提交于 2020-01-06 02:47:08

问题


I'm getting into Polymer and i like the deps resolution approach using imports.
And i like the extending capability through the behaviors config.
However, there's something that doesn't feel comfortable to me, about behaviors in particular.
Looking at the PolymerElements code i see that behaviors, are defined inside their own html in the global object Polymer and then referenced directly when imported by another component..
For example:

paper-button imports paper-button-behavior https://github.com/PolymerElements/paper-button/blob/master/paper-button.html#L14

it then defines paper-button-behavior as behavior referencing from global Polymer.PaperButtonBehavior https://github.com/PolymerElements/paper-button/blob/master/paper-button.html#L144

wich is defined here (the imported html) https://github.com/PolymerElements/paper-behaviors/blob/master/paper-button-behavior.html#L49

Ain't it an anti-pattern, especially as typically an app will not use Polymer's world exclusively?

来源:https://stackoverflow.com/questions/30597614/polymer-and-globals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!