Skip to content

Instantly share code, notes, and snippets.

View eissasoubhi's full-sized avatar

Eissa Soubhi eissasoubhi

View GitHub Profile
@eissasoubhi
eissasoubhi / DataManager.js
Last active June 8, 2021 19:45
DataManager to manage continuous AJAX loading on an event (eg: on scroll to bottom)
// =========================== EventManager ========================
function EventManager () {
// events store
this.events_queue = {};
}
// Register an event
EventManager.prototype.on = function (event_name, closure) {
if (! Array.isArray(this.events_queue[event_name]) ) {
this.events_queue[event_name] = [];
}