UNPKG

camelot-unchained

Version:
34 lines (33 loc) 1.26 kB
/** * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; var client = null; function hasClientAPI() { return window.opener && window.opener.cuAPI || window.cuAPI; } exports.hasClientAPI = hasClientAPI; if (window.opener && window.opener.cuAPI) { client = window.opener.cuAPI; // bind the alias to parent (as this instance will only have basic cuAPI functions) } else if (window.cuAPI) { client = window.cuAPI; // not a popout, so use existing cuAPI } else { // create a mock cuAPI to return client = { loginToken: 'developer', apiVersion: 1, webAPIHost: 'http://localhost:1337', characterID: 'KCt3dNCC6dKPyNzD0SR200', shardID: 1, debug: true }; } if (!client.webAPIHost) client.webAPIHost = 'http://localhost:1337'; if (!client.apiVersion) client.apiVersion = 1; if (!client.shardID) client.shardID = 1; if (!client.characterID) client.characterID = 'KCt3dNCC6dKPyNzD0SR200'; client.signalRHost = client.webAPIHost + '/signalr'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = client;