mirror of
https://github.com/rastapasta/mapscii.git
synced 2024-11-22 08:03:07 +01:00
Merge pull request #58 from rastapasta/unhandled-mapscii-init
Unhandled mapscii init
This commit is contained in:
commit
cf4731682e
5
main.js
5
main.js
@ -11,4 +11,7 @@
|
|||||||
const Mapscii = require('./src/Mapscii');
|
const Mapscii = require('./src/Mapscii');
|
||||||
|
|
||||||
const mapscii = new Mapscii();
|
const mapscii = new Mapscii();
|
||||||
mapscii.init();
|
mapscii.init().catch((err) => {
|
||||||
|
console.error('Failed to start MapSCII.');
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
@ -43,8 +43,7 @@ class Mapscii {
|
|||||||
config = Object.assign(config, options);
|
config = Object.assign(config, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
async init() {
|
||||||
return new Promise((resolve) => {
|
|
||||||
if (!config.headless) {
|
if (!config.headless) {
|
||||||
this._initKeyboard();
|
this._initKeyboard();
|
||||||
this._initMouse();
|
this._initMouse();
|
||||||
@ -53,8 +52,6 @@ class Mapscii {
|
|||||||
this._initRenderer();
|
this._initRenderer();
|
||||||
this._draw();
|
this._draw();
|
||||||
this.notify('Welcome to MapSCII! Use your cursors to navigate, a/z to zoom, q to quit.');
|
this.notify('Welcome to MapSCII! Use your cursors to navigate, a/z to zoom, q to quit.');
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user