B4J Question using document.addEventListener

TomDuncan

Active Member
Licensed User
Hi All,
I have a nice calendah that I would like to use in a websocket app.
It uses json as a file load for data.

Here is the site for the code.

https://fullcalendar.io/download


How call I call this from my websocket.
I don't have much of an idea on how to use java.

Here is the Script.
B4X:
  document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
      plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
      header: {
        left: 'prev,next today',
        center: 'title',
        right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
      },
      defaultDate: '2019-03-12',
      editable: true,
      navLinks: true, // can click day/week names to navigate views
      eventLimit: true, // allow "more" link when too many events
      events: {
        url: 'php/get-events.php',
        failure: function() {
          document.getElementById('script-warning').style.display = 'block'
        }
      },
      loading: function(bool) {
        document.getElementById('loading').style.display =
          bool ? 'block' : 'none';
      }
    });

    calendar.render();
  });
Thanks in advance
 
Top