Skip to content

Commit

Permalink
Update ES6 Module Example
Browse files Browse the repository at this point in the history
  • Loading branch information
sgurin committed Feb 5, 2020
1 parent 76484b0 commit 42ed31f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
2 changes: 1 addition & 1 deletion js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jQuery.noConflict();
(($) => {
// When DOM is ready
$(() => {
dotsEffect.init();
dotsEffect($);
});
})(jQuery);
40 changes: 17 additions & 23 deletions js/modules/dots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,25 @@
//
// You can remove or add your own function in this file.

const dotsEffect = (($) => {
const createCells = () => {
const width = 10;
const height = 10;
const size = width * height;
let html = '<div class="entry-cells">';
const createCells = () => {
const width = 10;
const height = 10;
const size = width * height;
let html = '<div class="entry-cells">';

for (let i = 0; i < size; i += 1) {
html += `<div class="cell cell-${i}"></div>`;
}
for (let i = 0; i < size; i += 1) {
html += `<div class="cell cell-${i}"></div>`;
}

html += '</div>';
html += '</div>';

return html;
};
return html;
};

const init = () => {
const $cnt = $('.entry-section');
const cells = createCells();
$cnt.html(cells);
};
const init = ($) => {
const $cnt = $('.entry-section');
const cells = createCells();
$cnt.html(cells);
};

return {
init,
};
})(jQuery);

export default dotsEffect;
export default init;

0 comments on commit 42ed31f

Please sign in to comment.