From 13cdaa2d6bae87e8e4a510aa782003542e302983 Mon Sep 17 00:00:00 2001 From: jimmy-dee <32086299+jimmy-dee@users.noreply.github.com> Date: Mon, 17 Jun 2019 08:41:58 +1000 Subject: [PATCH] Updated index.js to include callback --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index dabaeb7..ec0dad8 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,10 @@ class Eqio { - constructor(el) { + constructor(el, callback) { if (!el || !('IntersectionObserver' in window)) { return; } + this.callback = callback; this.init(el); } @@ -89,6 +90,10 @@ class Eqio { } } }); + + if (this.callback) { + this.callback(); + } }; this.observer = new IntersectionObserver(observerCallback, observerOptions);