31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { Injectable, Inject } from '@angular/core';
 | 
						|
import { Store, select } from '@ngrx/store';
 | 
						|
 | 
						|
import { Observable } from 'rxjs/Observable';
 | 
						|
import { Subject } from 'rxjs/Subject';
 | 
						|
 | 
						|
import { RPCClient } from 'packages/core/rpc/client/RPCClient';
 | 
						|
import { RPCClientCodec } from 'packages/core/rpc/protocol/RPCClientCodec';
 | 
						|
import { RPCClientRWC } from 'packages/core/rpc/client/rwc/RPCClientRWC';
 | 
						|
import { RPCClientNotificationCodec } from 'packages/core/rpc/protocol/RPCClientCodec';
 | 
						|
 | 
						|
import { notificationAction } from 'packages/core/rpc/store/notification';
 | 
						|
 | 
						|
import * as AppStore from '../store';
 | 
						|
 | 
						|
 | 
						|
@Injectable()
 | 
						|
export class RPCService extends RPCClient {
 | 
						|
  constructor(
 | 
						|
    private _rpcClientCodec: RPCClientCodec,
 | 
						|
    private _rpcClientRWC: RPCClientRWC,
 | 
						|
    private store: Store<AppStore.State>,
 | 
						|
  ) {
 | 
						|
    super(_rpcClientCodec, _rpcClientRWC);
 | 
						|
  }
 | 
						|
 | 
						|
  protected onNotification(notiCodec: RPCClientNotificationCodec): void {
 | 
						|
    this.store.dispatch(notificationAction(notiCodec.method(), notiCodec.params()));
 | 
						|
  }
 | 
						|
}
 |