UNPKG

burst-whale-watch

Version:

An account watcher for Burstcoin

62 lines 1.97 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Stappo = require("stappo"); const scene_1 = require("./scene"); const header_view_1 = require("./header.view"); const brs_collector_1 = require("../collectors/brs.collector"); const accountList_view_1 = require("./accountList.view"); const cmc_collector_1 = require("../collectors/cmc.collector"); const getInitialState = () => ({ app: { currentAccountIndex: 0, }, balances: { total: "", isLoading: true, accounts: {} }, transactions: { isLoading: true, accounts: {} }, market: { name: 'coinmarketcap.com', isLoading: true, price_usd: '...', price_btc: '...', percent_change_24h: '...', } }); class App { constructor(config) { this.config = config; } initialize() { this.store = new Stappo(); this.scene = new scene_1.Scene(this.store, this.config); this.store.update(getInitialState); this.storeListenerId = this.store.listen(this.scene.render.bind(this.scene)); this.brsCollector = new brs_collector_1.BrsCollector(this.store, this.config); this.cmcCollector = new cmc_collector_1.CmcCollector(this.store); this.scene.addView("header", new header_view_1.HeaderView()); this.scene.addView("accountList", new accountList_view_1.AccountListView(this.config)); } start(onExit) { this.initialize(); this.scene.onExit(({ reason, detail }) => { this.stop(); onExit(reason, detail); }); this.scene.render(getInitialState()); this.brsCollector.start(); this.cmcCollector.start(); } stop() { this.store.unlisten(this.storeListenerId); this.brsCollector.stop(); this.cmcCollector.stop(); this.scene.destroy(); } } exports.App = App; //# sourceMappingURL=app.js.map