feat: pass parent element id to constructor

This commit is contained in:
Ayo 2022-09-16 20:34:53 +02:00
parent eb3ea8110c
commit 7ca3f5751b
2 changed files with 5 additions and 5 deletions

View file

@ -3,5 +3,5 @@ import './modules/loading/loading.css';
import './assets/favicon.ico';
import { Minesweeper } from './minesweeper.js';
const myMinesweeper = new Minesweeper();
myMinesweeper.initialize();
const myMinesweeper = new Minesweeper('app');
myMinesweeper.initialize();

View file

@ -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');