UNPKG

atriusmaps-node-sdk

Version:

This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information

28 lines (24 loc) 735 B
'use strict'; var app = require('./app.js'); const apps = {}; const sendAlert = (msg) => typeof window !== "undefined" && window.alert ? window.alert(msg) : console.error(msg); async function create(config) { if (!config) { throw Error("Attempt to create App instance with no configuration"); } const appName = config.appName || "Instance" + (Object.keys(apps).length + 1); config.appName = appName; try { const app$1 = await app.create(config); apps[appName] = app$1; return app$1; } catch (e) { console.error(e); if (e instanceof Error && e.message) { sendAlert(e.message); } else { sendAlert("Error creating map. Please try again later."); } } } exports.create = create;