Bytom Wallet for Chrome
Revision | 5c6ac28fcb95a0e2a18ddf6f1af7c29f7726b9f0 (tree) |
---|---|
Time | 2020-10-13 12:04:46 |
Author | Zhiting Lin <zlin035@uott...> |
Commiter | Zhiting Lin |
update the sync storage for multiple store.
@@ -34,6 +34,7 @@ import _ from 'lodash' | ||
34 | 34 | import * as Sentry from "@sentry/browser"; |
35 | 35 | import { Vue as VueIntegration } from "@sentry/integrations"; |
36 | 36 | import { Integrations } from '@sentry/tracing'; |
37 | +import BytomObj from "./utils/Bytom"; | |
37 | 38 | |
38 | 39 | store.dispatch(Actions.LOAD_BYTOM).then(() => { |
39 | 40 | Vue.use(VueI18n) |
@@ -88,6 +89,14 @@ store.dispatch(Actions.LOAD_BYTOM).then(() => { | ||
88 | 89 | |
89 | 90 | account.setupNet(`${store.getters.net}${store.getters.netType}`) |
90 | 91 | |
92 | + apis.storage.onChanged.addListener(function(changes, namespace) { | |
93 | + for (let key in changes) { | |
94 | + if(key === 'bytom'){ | |
95 | + store.dispatch(Actions.LOAD_BYTOM) | |
96 | + } | |
97 | + } | |
98 | + }); | |
99 | + | |
91 | 100 | store.watch( |
92 | 101 | (state, getters) => getters.netType, |
93 | 102 | (newValue, oldValue) => { |
@@ -32,6 +32,7 @@ import _ from 'lodash' | ||
32 | 32 | import * as Sentry from "@sentry/browser"; |
33 | 33 | import { Vue as VueIntegration } from "@sentry/integrations"; |
34 | 34 | import { Integrations } from '@sentry/tracing'; |
35 | +import BytomObj from "./utils/Bytom"; | |
35 | 36 | |
36 | 37 | store.dispatch(Actions.LOAD_BYTOM).then(() => { |
37 | 38 | Vue.use(VueI18n) |
@@ -71,6 +72,14 @@ store.dispatch(Actions.LOAD_BYTOM).then(() => { | ||
71 | 72 | } |
72 | 73 | } |
73 | 74 | |
75 | + apis.storage.onChanged.addListener(function(changes, namespace) { | |
76 | + for (let key in changes) { | |
77 | + if(key === 'bytom'){ | |
78 | + store.dispatch(Actions.LOAD_BYTOM) | |
79 | + } | |
80 | + } | |
81 | + }); | |
82 | + | |
74 | 83 | Sentry.init({ |
75 | 84 | dsn: "https://f080e90fe9d94cf9b05323b373d839f3@o441881.ingest.sentry.io/5412722", |
76 | 85 | release: "byone@" + process.env.npm_package_version, |