Merge pull request #28 from fullhacker/27-feature-pass-parent-element-id-to-the-constructor

feat: pass parent element id to constructor
This commit is contained in:
Ayo Ayco 2022-09-16 20:35:24 +02:00 committed by GitHub
commit b5f3767f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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');