UNPKG

@blockv/sdk

Version:

Allows web apps to display and interact with vatoms.

65 lines (50 loc) 2.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _DataPool = _interopRequireDefault(require("../internal/DataPool")); var _Store = _interopRequireDefault(require("../internal/repo/Store")); var _UserManager = _interopRequireDefault(require("./manager/UserManager")); var _UserApi = _interopRequireDefault(require("../internal/net/rest/api/UserApi")); var _Vatoms = _interopRequireDefault(require("./manager/Vatoms")); var _Activity = _interopRequireDefault(require("./manager/Activity")); var _ActivityApi = _interopRequireDefault(require("../internal/net/rest/api/ActivityApi")); var _Client = _interopRequireDefault(require("../internal/net/Client")); var _WebSockets = _interopRequireDefault(require("./manager/WebSockets")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // // BlockV AG. Copyright (c) 2018, all rights reserved. // // Licensed under the BlockV SDK License (the "License"); you may not use this file or // the BlockV SDK except in compliance with the License accompanying it. Unless // required by applicable law or agreed to in writing, the BlockV SDK distributed under // the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF // ANY KIND, either express or implied. See the License for the specific language // governing permissions and limitations under the License. // class Blockv { constructor(payload) { const prefix = payload.prefix || payload.appID; this.store = new _Store.default(prefix); this.store.appID = payload.appID; this.store.server = payload.server || 'https://api.blockv.io'; this.store.websocketAddress = payload.websocketAddress || 'wss://newws.blockv.io'; this.dataPool = new _DataPool.default(this); this.dataPool.Blockv = this; this.client = new _Client.default(this); const userApi = new _UserApi.default(this); const activityApi = new _ActivityApi.default(this.client); this.Activity = new _Activity.default(activityApi); this.WebSockets = new _WebSockets.default(this.store, this.client); this.UserManager = new _UserManager.default(userApi, this.store); this.Vatoms = new _Vatoms.default(this); if (this.UserManager.isLoggedIn) { this.dataPool.setSessionInfo({ userID: this.store.userID, client: this.client }); } } } exports.default = Blockv;