feat: pass parent element id to constructor
This commit is contained in:
parent
eb3ea8110c
commit
7ca3f5751b
2 changed files with 5 additions and 5 deletions
|
@ -3,5 +3,5 @@ import './modules/loading/loading.css';
|
||||||
import './assets/favicon.ico';
|
import './assets/favicon.ico';
|
||||||
import { Minesweeper } from './minesweeper.js';
|
import { Minesweeper } from './minesweeper.js';
|
||||||
|
|
||||||
const myMinesweeper = new Minesweeper();
|
const myMinesweeper = new Minesweeper('app');
|
||||||
myMinesweeper.initialize();
|
myMinesweeper.initialize();
|
||||||
|
|
|
@ -6,13 +6,13 @@ import {
|
||||||
} from './modules';
|
} from './modules';
|
||||||
import { levels } from './levels.js';
|
import { levels } from './levels.js';
|
||||||
|
|
||||||
const VERSION = "0.3.11";
|
const VERSION = "0.3.12";
|
||||||
const MOBILE_BUSY_DELAY = 250;
|
const MOBILE_BUSY_DELAY = 250;
|
||||||
const PC_BUSY_DELAY = 500;
|
const PC_BUSY_DELAY = 500;
|
||||||
const TEST_MODE = false;
|
const TEST_MODE = false;
|
||||||
const CASUAL_MODE = false;
|
const CASUAL_MODE = false;
|
||||||
|
|
||||||
export const Minesweeper = function() {
|
export const Minesweeper = function(appId) {
|
||||||
const _this = this;
|
const _this = this;
|
||||||
const storageService = new StorageService();
|
const storageService = new StorageService();
|
||||||
const timerService = new TimerService();
|
const timerService = new TimerService();
|
||||||
|
@ -27,7 +27,7 @@ export const Minesweeper = function() {
|
||||||
let footbar = document.createElement('div');
|
let footbar = document.createElement('div');
|
||||||
let customWrapper = document.createElement('div');
|
let customWrapper = document.createElement('div');
|
||||||
customWrapper.setAttribute('id', 'custom-wrapper');
|
customWrapper.setAttribute('id', 'custom-wrapper');
|
||||||
let appElement = document.getElementById('app');
|
let appElement = document.getElementById(appId);
|
||||||
if (!appElement) {
|
if (!appElement) {
|
||||||
const body = document.getElementsByTagName('body')[0];
|
const body = document.getElementsByTagName('body')[0];
|
||||||
appElement = document.createElement('div');
|
appElement = document.createElement('div');
|
||||||
|
|
Loading…
Reference in a new issue