Listings

Listings is the service which handles scheduling of events, like an EPG in TV-speak

With Studio is initialised, you can now use methods of the Listings object to find the current or next Event.

Let's check if there are any current Events, and if so use the first one. If there isn't any current Event, we'll use the getNext() method to identify the next upcoming M/IC Event.

If either a current or future Event is detected , it will set our current working Event.

Example

// Assume LViS is initialised

// shorthand
var L = LViS.Listings;

var handleEventReady = function () {
  console.log('Event is ready!');
};

// Process Event Listings 
var processListings = function () {
  var current = L.getCurrent(),
      next = L.getNext();

  if (current !== null) {
    event = current;
  } else if (next !== null) {
    event = next;
  }

  event.bind(LViS.Event.ON_READY, handleEventReady);

  LViS.setEvent(event);
};

L.bind(L.ON_UPDATE, processListings);

// force listings processing
processListings();

Last updated