Hi polymer devs,
I've recently been involved in porting the trace-viewer[1] project bundled with Google Chrome to use Polymer.
Given the size of the project, and the fact that it's mostly just one big page, we've run into the need to use namespaces for our modules. In order to avoid conflicts we've attempted to implement the rule that each constructor for a polymer element should have a name like:
/path/to/file + ElementConstructor => PathToFileElementConstructor
Unfortunately, this quickly gets out of hand and has a major readability impact in the code. An example is a polymer element defined in the file /tracing/analysis/analysis-view.html. This ends up being TracingAnalysisAnalysisView. What would be really useful is to be able to export the constructor of the element within a namespace, and not have it stuck to the window object.
I'm looking for something along the lines of:
<polymer-element name="foo-element" constructor="FooElement" namespace="foo.space">
<style>
/* css */
</style>
<template>
<!-- More HTML -->
</template>
<script>
Polymer({
ready: function(){
this.barProperty = [];
}
});
</script>
</polymer-element>
/* some other file */
<link rel="import" href="foo/space/foo_element.html">
<script>
var fooElement = new foo.space.FooElement();
</script>
I've read the available documentation on this, but I could not find an appropriate way to actually solve this issue. Is there any trick available to solve this?
Regards,
Vicențiu Ciorbaru