File tree Expand file tree Collapse file tree 3 files changed +10
-21
lines changed
packages/node-runtime-worker-thread Expand file tree Collapse file tree 3 files changed +10
-21
lines changed Original file line number Diff line number Diff line change 14
14
"url" : " https://github.com/mongodb-js/mongosh"
15
15
},
16
16
"engines" : {
17
- "node" : " ^ 12.4.0"
17
+ "node" : " >= 12.4.0"
18
18
},
19
19
"scripts" : {
20
20
"pretest" : " npm run webpack-build-dev -- --no-stats --no-devtool" ,
Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ const worker = createCaller(
40
40
41
41
function waitForWorkerReadyProxy < T extends Function > ( fn : T ) : T {
42
42
return new Proxy ( fn , {
43
- async apply ( target , thisArg , argumetsList ) {
43
+ async apply ( target , thisArg , argumentsList ) {
44
44
await workerReadyPromise ;
45
- return target . call ( thisArg , ...Array . from ( argumetsList ) ) ;
45
+ return target . call ( thisArg , ...Array . from ( argumentsList ) ) ;
46
46
}
47
47
} ) ;
48
48
}
Original file line number Diff line number Diff line change @@ -16,33 +16,22 @@ class WorkerEvaluationListener {
16
16
this . exposedListener = exposeAll < EvaluationListener > (
17
17
{
18
18
onPrompt ( question , type ) {
19
- if ( workerRuntime . evaluationListener ?. onPrompt ) {
20
- return workerRuntime . evaluationListener . onPrompt ( question , type ) ;
21
- }
22
-
23
- return '' ;
19
+ return workerRuntime . evaluationListener . onPrompt ?.( question , type ) ?? '' ;
24
20
} ,
25
- onPrint ( value ) {
26
- if ( workerRuntime . evaluationListener ?. onPrint ) {
27
- workerRuntime . evaluationListener . onPrint ( value ) ;
21
+ onPrint ( values ) {
22
+ return workerRuntime . evaluationListener ?. onPrint ?.( values ) ;
28
23
}
29
24
} ,
30
25
toggleTelemetry ( enabled ) {
31
- if ( workerRuntime . evaluationListener ?. toggleTelemetry ) {
32
- workerRuntime . evaluationListener . toggleTelemetry ( enabled ) ;
26
+ return workerRuntime . evaluationListener ?. toggleTelemetry ?.( enabled ) ;
33
27
}
34
28
} ,
35
29
onClearCommand ( ) {
36
- if ( workerRuntime . evaluationListener ?. onClearCommand ) {
37
- workerRuntime . evaluationListener . onClearCommand ( ) ;
38
- }
30
+ return workerRuntime . evaluationListener . onClearCommand ?.( ) ;
39
31
} ,
40
32
onExit ( ) {
41
- if ( workerRuntime . evaluationListener ?. onExit ) {
42
- return workerRuntime . evaluationListener . onExit ( ) ;
43
- }
44
-
45
- return Promise . resolve ( ) as Promise < never > ;
33
+ return workerRuntime . evaluationListener ?. onExit ?.( ) ??
34
+ Promise . resolve ( ) as Promise < never > ;
46
35
}
47
36
} ,
48
37
childProcess
You can’t perform that action at this time.
0 commit comments