File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 "debug" : " ^3.1.0" ,
2222 "graphql" : " ^0.13.2" ,
2323 "phoenix" : " ^1.3.4" ,
24- "phoenix-channels" : " ^1.0.0"
24+ "phoenix-channels" : " ^1.0.0" ,
25+ "wolfy87-eventemitter" : " ^5.2.5"
2526 },
2627 "devDependencies" : {
2728 "babel-cli" : " ^6.26.0" ,
Original file line number Diff line number Diff line change 11const axios = require ( 'axios' ) ;
2- const EventEmitter = require ( 'events' ) ;
32const { print, parse } = require ( 'graphql' ) ;
43const {
54 getQueryBuilders,
@@ -57,6 +56,10 @@ class OCAPClientBase {
5756 throw new Error ( '_getSocketImplementation must be implemented in sub class' ) ;
5857 }
5958
59+ _getEventImplementation ( ) {
60+ throw new Error ( '_getEventImplementation must be implemented in sub class' ) ;
61+ }
62+
6063 _getQueryId ( ) {
6164 throw new Error ( '_getQueryId must be implemented in sub class' ) ;
6265 }
@@ -143,6 +146,7 @@ class OCAPClientBase {
143146 debug ( 'subscription success' , { queryId, res } ) ;
144147
145148 // create a new EventEmitter for each subscription
149+ const EventEmitter = this . _getEventImplementation ( ) ;
146150 this . subscriptions [ queryId ] = new EventEmitter ( ) ;
147151 this . subscriptions [ queryId ] . subscriptionId = res . subscriptionId ;
148152
Original file line number Diff line number Diff line change 11const schemas = require ( '@arcblock/ocap-schema' ) ;
22const md5 = require ( 'blueimp-md5' ) ;
3+ const EventEmitter = require ( 'wolfy87-eventemitter' ) ;
34const { Socket } = require ( 'phoenix' ) ;
45const OCAPClientBase = require ( './base' ) ;
56
@@ -16,6 +17,10 @@ class OCAPBrowserClient extends OCAPClientBase {
1617 return Socket ;
1718 }
1819
20+ _getEventImplementation ( ) {
21+ return EventEmitter ;
22+ }
23+
1924 /**
2025 * Get ignored field lists that need to be excluded when build graphql queries
2126 * These fields are ignored because they may cause query failure
Original file line number Diff line number Diff line change 11const schemas = require ( '@arcblock/ocap-schema' ) ;
22const md5 = require ( 'blueimp-md5' ) ;
3+ const EventEmitter = require ( 'events' ) ;
34const { Socket } = require ( 'phoenix-channels' ) ;
45const OCAPClientBase = require ( './base' ) ;
56
@@ -16,6 +17,10 @@ class OCAPClient extends OCAPClientBase {
1617 return Socket ;
1718 }
1819
20+ _getEventImplementation ( ) {
21+ return EventEmitter ;
22+ }
23+
1924 /**
2025 * Get ignored field lists that need to be excluded when build graphql queries
2126 * These fields are ignored because they may cause query failure
Original file line number Diff line number Diff line change @@ -4060,6 +4060,10 @@ window-size@0.1.0:
40604060 version "0.1.0"
40614061 resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
40624062
4063+ wolfy87-eventemitter@^5.2.5 :
4064+ version "5.2.5"
4065+ resolved "https://registry.yarnpkg.com/wolfy87-eventemitter/-/wolfy87-eventemitter-5.2.5.tgz#e7af2adbb84e481c65edeb2a2e01032c8ff1b88f"
4066+
40634067wordwrap@0.0.2 :
40644068 version "0.0.2"
40654069 resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
You can’t perform that action at this time.
0 commit comments