From 7ca3f5751bd4be2dd559b496b15f5a0e5cf27e90 Mon Sep 17 00:00:00 2001 From: Ayo Date: Fri, 16 Sep 2022 20:34:53 +0200 Subject: [PATCH] feat: pass parent element id to constructor --- src/index.js | 4 ++-- src/minesweeper.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index 2025a83..f9322fa 100644 --- a/src/index.js +++ b/src/index.js @@ -3,5 +3,5 @@ import './modules/loading/loading.css'; import './assets/favicon.ico'; import { Minesweeper } from './minesweeper.js'; -const myMinesweeper = new Minesweeper(); -myMinesweeper.initialize(); \ No newline at end of file +const myMinesweeper = new Minesweeper('app'); +myMinesweeper.initialize(); diff --git a/src/minesweeper.js b/src/minesweeper.js index f8a3650..64c4c6a 100644 --- a/src/minesweeper.js +++ b/src/minesweeper.js @@ -6,13 +6,13 @@ import { } from './modules'; import { levels } from './levels.js'; -const VERSION = "0.3.11"; +const VERSION = "0.3.12"; const MOBILE_BUSY_DELAY = 250; const PC_BUSY_DELAY = 500; const TEST_MODE = false; const CASUAL_MODE = false; -export const Minesweeper = function() { +export const Minesweeper = function(appId) { const _this = this; const storageService = new StorageService(); const timerService = new TimerService(); @@ -27,7 +27,7 @@ export const Minesweeper = function() { let footbar = document.createElement('div'); let customWrapper = document.createElement('div'); customWrapper.setAttribute('id', 'custom-wrapper'); - let appElement = document.getElementById('app'); + let appElement = document.getElementById(appId); if (!appElement) { const body = document.getElementsByTagName('body')[0]; appElement = document.createElement('div');