From 42ed31f73841db7a24e9e8d33518408a14808206 Mon Sep 17 00:00:00 2001 From: Stanislav Gurin Date: Wed, 5 Feb 2020 18:18:38 +0200 Subject: [PATCH] Update ES6 Module Example --- js/app.js | 2 +- js/modules/dots.js | 40 +++++++++++++++++----------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/js/app.js b/js/app.js index bbf9973..2dd136b 100644 --- a/js/app.js +++ b/js/app.js @@ -10,6 +10,6 @@ jQuery.noConflict(); (($) => { // When DOM is ready $(() => { - dotsEffect.init(); + dotsEffect($); }); })(jQuery); diff --git a/js/modules/dots.js b/js/modules/dots.js index 7c9ee77..69fcd92 100644 --- a/js/modules/dots.js +++ b/js/modules/dots.js @@ -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 = '
'; +const createCells = () => { + const width = 10; + const height = 10; + const size = width * height; + let html = '
'; - for (let i = 0; i < size; i += 1) { - html += `
`; - } + for (let i = 0; i < size; i += 1) { + html += `
`; + } - html += '
'; + html += '
'; - 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;