Merge pull request #58 from rastapasta/unhandled-mapscii-init

Unhandled mapscii init
This commit is contained in:
Christian Paul 2018-11-19 00:41:06 -08:00 committed by GitHub
commit cf4731682e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -11,4 +11,7 @@
const Mapscii = require('./src/Mapscii');
const mapscii = new Mapscii();
mapscii.init();
mapscii.init().catch((err) => {
console.error('Failed to start MapSCII.');
console.error(err);
});

View File

@ -43,18 +43,15 @@ class Mapscii {
config = Object.assign(config, options);
}
init() {
return new Promise((resolve) => {
if (!config.headless) {
this._initKeyboard();
this._initMouse();
}
this._initTileSource();
this._initRenderer();
this._draw();
this.notify('Welcome to MapSCII! Use your cursors to navigate, a/z to zoom, q to quit.');
resolve();
});
async init() {
if (!config.headless) {
this._initKeyboard();
this._initMouse();
}
this._initTileSource();
this._initRenderer();
this._draw();
this.notify('Welcome to MapSCII! Use your cursors to navigate, a/z to zoom, q to quit.');
}