import { Store } from 'react-redux' ; import { SharedState } from '../../worker/WorkerState' ; import { SharedStateBroadcastEvent } from '../../lib/rpc/SharedStateBroadcast' ; import { FrameState } from '../redux/FrameState' ; import { setSharedState } from '../redux/actions' ; import JsonRpcClient from '../../lib/messaging/JsonRpcClient' ; export default class RemoteStoreUpdater { private initialState : SharedState ; private client : JsonRpcClient ; constructor ( client , initial ) { this . initialState = initial ; this . client = client ; } wireToLocal ( store ) { this . client . addListener ( SharedStateBroadcastEvent , ( sharedState ) => store . dispatch ( setSharedState ( sharedState ) ) ) ; store . dispatch ( setSharedState ( this . initialState ) ) ; } }