Merge branch 'hotfix/21.56.9' into master
[gitter.git] / public / js / utils / onready.js
blob47fbeef36617a2ad24ddab8d6dee6bf1571d357c
1 'use strict';
3 // Implements EventListener
4 function OnceEventListener(target, type, callback, context) {
5   target.addEventListener(type, this, false);
7   this.handleEvent = function(e) {
8     target.removeEventListener(type, this, false);
9     callback.call(context, e);
10   };
13 module.exports = function onReady(callback, context) {
14   new OnceEventListener(window, 'DOMContentLoaded', callback, context);