@@ -92,7 +92,7 @@ var ErrorMessage = {
92
92
WorkerNotSupported : { code : 507 , text : "This browser doesn't support web workers." } ,
93
93
ThreadAllocationTimeout : { code : 508 , text : "Thread allocation failed due to timeout." } ,
94
94
MethodAssignment : { code : 509 , text : "Can't assign a method." } ,
95
- NonFunctionLoad : { code : 510 , text : "Can't load an export of type '%{0}'." } ,
95
+ NotAccessibleExport : { code : 510 , text : "Can't access an export of type '%{0}'. Only top level functions and classes are imported ." } ,
96
96
ThreadPoolTerminated : { code : 511 , text : "Thread pool has been terminated." } ,
97
97
ThreadTerminated : { code : 512 , text : "Thread has been terminated." }
98
98
} ;
@@ -281,22 +281,22 @@ var ConcurrentModule = class {
281
281
const thread = await this . pool . getThread ( ) ;
282
282
const cache = { } ;
283
283
return new Proxy ( module2 , {
284
- get ( module3 , exportName ) {
285
- const _export = Reflect . get ( module3 , exportName ) ;
286
- if ( ! Reflect . has ( module3 , exportName ) )
284
+ get ( obj , key ) {
285
+ const _export = Reflect . get ( obj , key ) ;
286
+ if ( ! Reflect . has ( obj , key ) )
287
287
return ;
288
288
else if ( ! isFunction ( _export ) )
289
- throw new ConcurrencyError ( ErrorMessage . NonFunctionLoad ) ;
289
+ throw new ConcurrencyError ( ErrorMessage . NotAccessibleExport ) ;
290
290
else {
291
- if ( ! Reflect . has ( cache , exportName ) )
292
- Reflect . set ( cache , exportName , createFunctionProxy ( thread , moduleSrc , _export ) ) ;
293
- return Reflect . get ( cache , exportName ) ;
291
+ if ( ! Reflect . has ( cache , key ) )
292
+ Reflect . set ( cache , key , createThreadedFunction ( thread , moduleSrc , _export ) ) ;
293
+ return Reflect . get ( cache , key ) ;
294
294
}
295
295
}
296
296
} ) ;
297
297
}
298
298
} ;
299
- function createFunctionProxy ( thread , moduleSrc , target ) {
299
+ function createThreadedFunction ( thread , moduleSrc , target ) {
300
300
const threadedFunction = new ThreadedFunction ( thread , moduleSrc , target . name ) ;
301
301
return new Proxy ( target , {
302
302
get ( target2 , key ) {
@@ -327,14 +327,14 @@ function createFunctionProxy(thread, moduleSrc, target) {
327
327
}
328
328
} ,
329
329
construct ( target2 , args ) {
330
- return createObjectProxy ( thread , moduleSrc , target2 . name , args ) ;
330
+ return createThreadedObject ( thread , moduleSrc , target2 . name , args ) ;
331
331
} ,
332
332
apply ( _target , _thisArg , args ) {
333
333
return threadedFunction . invoke ( args ) ;
334
334
}
335
335
} ) ;
336
336
}
337
- async function createObjectProxy ( thread , moduleSrc , exportName , args ) {
337
+ async function createThreadedObject ( thread , moduleSrc , exportName , args ) {
338
338
const threadedObject = await ThreadedObject . create ( thread , moduleSrc , exportName , args ) ;
339
339
return new Proxy ( threadedObject . target , {
340
340
get ( target , key ) {
@@ -518,7 +518,7 @@ var Master = class {
518
518
if ( this . started )
519
519
this . pool . config ( this . settings ) ;
520
520
}
521
- module ( moduleSrc ) {
521
+ import ( moduleSrc ) {
522
522
if ( ! this . settings . disabled && ! this . started )
523
523
this . start ( ) ;
524
524
const module2 = this . settings . disabled ? {
0 commit comments