Get Event History

<Array> getHistory()

Returns a list of all published elements as an array. Each element of array is an object representing element as described in elements API.

Do not call this method until LViS.setEvent callback is invoked as history might not be available until then.

There is a known issue when in some cases event does not return elements which where published while the app was not connected to LViS. The following code provides a temporary workaround by re-fetching event's history when connection to LViS is re-established. It uses undocumented method loadHistory(), so please don't use it in any other context.

let event = LViS.getEvent();
let host = LViS.getHost();
LViS.ConnectionManager.bind(LViS.ConnectionManager.ON_STATE, (state) => {
switch (state) {
case LViS.ConnectionManager.STATE_CONNECTED:
event.loadHistory(host).done(() => {
console.log(event.getHistory());
});
break;
}
});

Example

var event = LViS.getEvent();
var history = event.getHistory();