title: How to make timer in alpine.js app with time interval
body: <p>With alpine.js 2 I try to make timer with definition in footer (which is set for all layout) of the app :</p>
  <pre><code>&lt;div&gt;
      
      &lt;div  x-data=&quot;appFooterComponent()&quot; x-init=&quot; console.log('initTimer()::'); refreshTime();
      setInterval(refreshTime, 1000) ; console.log('END initTimer::');&quot;&gt;
          &lt;div &gt;
              ...
              &lt;span style=&quot;background-color: yellow&quot; x-text=&quot;refreshTime(@this)&quot;&gt;&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
      // THAT DOES NOT WORK
      // this.refreshTime()
      // setInterval(refreshTime, 1000)
  
      function appFooterComponent() {
          return {
              refreshTime() {
                  return moment(new Date()).format('DD MMMM, YYYY HH:mm:ss')
              },
          }
      } 
  
  &lt;/script&gt;
  </code></pre>
  <p>As result when any new page is opened I see how current datetime is set, but without interval and time is not refreshed any second.
  In console I see output of  x-init console commands, but not time interval...
  How to fix it ?</p>
  <p>Thanks!</p>