Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any established patterns for global settings/state for components?

Tags:

polymer

Currently, I've got a component something like this:

<polymer-element name="my-widget" constructor="MyWidget">
  <script>
    Polymer('my-widget', {});
    MyWidget.someGlobalConfigValue = 1234;
  </script>
</polymer-element>

Are there other approaches to this that I should consider?

(aside: It'd be neat if Polymer() returned the constructor, so I don't have to force a name)

like image 793
Nevir Avatar asked Apr 18 '14 15:04

Nevir


1 Answers

One pattern is to use a component for configuration: http://www.polymer-project.org/docs/polymer/polymer.html#global

like image 170
ebidel Avatar answered Oct 06 '22 06:10

ebidel