File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Protocol , Dependency , FnArgs } from "./protocol/protocol" ;
2
2
import { GothamConnection , SocketConnection } from './protocol/GothamConnection' ;
3
3
4
- export class GothamModule {
4
+ export default class GothamModule {
5
5
protocol : Protocol
6
6
constructor ( connection : GothamConnection ) {
7
7
this . protocol = new Protocol ( connection ) ;
Original file line number Diff line number Diff line change @@ -194,6 +194,8 @@ export class Protocol {
194
194
res = true ;
195
195
} else if ( obj . type === constants . responseType . hookTriggered ) {
196
196
res = await this . parseHookTriggered ( obj as TriggerHookRequest ) ;
197
+ } else if ( obj . type === constants . responseType . functionResponse ) {
198
+ res = await this . parseFunctionResponse ( obj as FunctionCallResponse ) ;
197
199
} else {
198
200
res = false ;
199
201
}
@@ -214,11 +216,19 @@ export class Protocol {
214
216
this . sendRequest ( {
215
217
requestId : obj . requestId ,
216
218
type : 'functionResponse' ,
217
- data : res
219
+ data : res || { }
218
220
} ) ;
221
+ return true ;
222
+ } else {
223
+ // Function wasn't found in the module.
224
+ return false ;
219
225
}
220
226
}
221
227
228
+ async parseFunctionResponse ( obj : FunctionCallResponse ) {
229
+ return obj . data ;
230
+ }
231
+
222
232
async parseHookTriggered ( obj : TriggerHookRequest ) {
223
233
if ( obj . hook ) {
224
234
// Hook triggered by another module.
You can’t perform that action at this time.
0 commit comments