Skip to content

Commit

Permalink
get container in getReady function
Browse files Browse the repository at this point in the history
  • Loading branch information
e-oj committed Jan 14, 2019
1 parent 2c08595 commit a3e2a77
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
7 changes: 3 additions & 4 deletions dist/magic-grid.cjs.js
Expand Up @@ -197,10 +197,6 @@ MagicGrid.prototype.positionItems = function positionItems () {
*/
MagicGrid.prototype.ready = function ready () {
if (this.static) { return true; }

this.container = document.querySelector(this.containerClass);
this.items = this.container.children;

return this.items.length >= this.size;
};

Expand All @@ -216,6 +212,9 @@ MagicGrid.prototype.getReady = function getReady () {
var this$1 = this;

var interval = setInterval(function () {
this$1.container = document.querySelector(this$1.containerClass);
this$1.items = this$1.container.children;

if (this$1.ready()) {
clearInterval(interval);

Expand Down
7 changes: 3 additions & 4 deletions dist/magic-grid.esm.js
Expand Up @@ -195,10 +195,6 @@ MagicGrid.prototype.positionItems = function positionItems () {
*/
MagicGrid.prototype.ready = function ready () {
if (this.static) { return true; }

this.container = document.querySelector(this.containerClass);
this.items = this.container.children;

return this.items.length >= this.size;
};

Expand All @@ -214,6 +210,9 @@ MagicGrid.prototype.getReady = function getReady () {
var this$1 = this;

var interval = setInterval(function () {
this$1.container = document.querySelector(this$1.containerClass);
this$1.items = this$1.container.children;

if (this$1.ready()) {
clearInterval(interval);

Expand Down
2 changes: 1 addition & 1 deletion dist/magic-grid.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/index.js
Expand Up @@ -157,10 +157,6 @@ class MagicGrid {
*/
ready () {
if (this.static) return true;

this.container = document.querySelector(this.containerClass);
this.items = this.container.children;

return this.items.length >= this.size;
}

Expand All @@ -174,6 +170,9 @@ class MagicGrid {
*/
getReady () {
let interval = setInterval(() => {
this.container = document.querySelector(this.containerClass);
this.items = this.container.children;

if (this.ready()) {
clearInterval(interval);

Expand Down

0 comments on commit a3e2a77

Please sign in to comment.