Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
inserts first-time calls to imageFetcher init and renderImages
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel committed Aug 10, 2016
1 parent 3c934ec commit 91ea9fa
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions assets/js/_board.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

Board.prototype.init = function() {
this.updateImages();
var self = this;
setInterval(this.renderImages, this.config.animationInterval, this.images, self);
this.renderImages(this.images, this);
setInterval(this.renderImages, this.config.animationInterval, this.images, this);
};

Board.prototype.parseImages = function(stringImages) {
Expand Down
1 change: 1 addition & 0 deletions assets/js/_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var main = function() {
var board = new Board($('section.board'));
board.init();
var imgFetch = new ImageFetcher(board);
fetchInit(imgFetch);
setInterval(fetchInit, 30000, imgFetch);
};
$(main);
5 changes: 3 additions & 2 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@

Board.prototype.init = function() {
this.updateImages();
var self = this;
setInterval(this.renderImages, this.config.animationInterval, this.images, self);
this.renderImages(this.images, this);
setInterval(this.renderImages, this.config.animationInterval, this.images, this);
};

Board.prototype.parseImages = function(stringImages) {
Expand Down Expand Up @@ -109,6 +109,7 @@ var main = function() {
var board = new Board($('section.board'));
board.init();
var imgFetch = new ImageFetcher(board);
fetchInit(imgFetch);
setInterval(fetchInit, 30000, imgFetch);
};
$(main);
2 changes: 1 addition & 1 deletion core/static/js/main.min.js

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

1 change: 1 addition & 0 deletions tests/spec/BoardSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('Board', function() {
it('should get images from localStorage and call parseImages with it as arg then pass to renderImages inside setInterval', function(){
var self = this;
spyOn(this.board, 'parseImages');
spyOn(this.board, 'renderImages');
spyOn(window, 'setInterval');
spyOn(localStorage, 'getItem').and.callFake(function() {
return JSON.stringify(self.gifsJson);
Expand Down

0 comments on commit 91ea9fa

Please sign in to comment.