title: Global functions in Polymer 2.0
body: <p>Is there any way to declare a global function in Polymer 2.0 that can be used in other components? I have a <code>moment.html</code> file for using moment.js in the project:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script src="../bower_components/moment/moment.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>In the same file I also declare a function instead of declaring it in every single component where I want to use it:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;script&gt;
    function format(date) {
      return moment(date).format('dddd, D MMMM YYYY');
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>The <code>moment</code> object is available after importing the file but when I try to call the <code>format</code> function it gives me the warning <code>method 'format' not defined</code>. How can I make the function publicly available?</p>
  
  <p><strong>Edit</strong>: I can call the <code>format</code> function from within the script tags of another component, but I cannot access it from within a template, i.e. with: </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;strong&gt;[[format(event.date)]]&lt;/strong&gt;
  </code></pre>
  
  <p>I want to render the result from the function on the page, not access it programmatically.</p>