@@ -259,8 +259,13 @@ function createWrapFunction (prefix = '', override = '') {
259
259
const operation = name . match ( / ^ ( .+ ?) ( S y n c ) ? ( \. n a t i v e ) ? $ / ) [ 1 ]
260
260
261
261
return function ( ) {
262
- if ( ! startChannel . hasSubscribers ) return original . apply ( this , arguments )
263
-
262
+ console . log ( `wrapFunction => function(): name: ${ name } , method: ${ method } , operation: ${ operation } ` )
263
+ console . log ( 'startChannel._stores' , startChannel . _stores )
264
+ if ( ! startChannel . hasSubscribers ) {
265
+ console . log ( `NO SUBSCRIBERS - name: ${ name } , method: ${ method } , operation: ${ operation } ` )
266
+ return original . apply ( this , arguments )
267
+ }
268
+ console . log ( `HAS_SUBSCRIBERS - name: ${ name } , method: ${ method } , operation: ${ operation } ` )
264
269
const lastIndex = arguments . length - 1
265
270
const cb = typeof arguments [ lastIndex ] === 'function' && arguments [ lastIndex ]
266
271
const params = getMethodParamsRelationByPrefix ( prefix ) [ operation ]
@@ -272,6 +277,7 @@ function createWrapFunction (prefix = '', override = '') {
272
277
ctx . error = error
273
278
errorChannel . publish ( ctx )
274
279
}
280
+ console . log ( 'finishChannel.runStores(ctx, cb)' )
275
281
return finishChannel . runStores ( ctx , cb )
276
282
}
277
283
@@ -282,6 +288,7 @@ function createWrapFunction (prefix = '', override = '') {
282
288
}
283
289
284
290
return startChannel . runStores ( ctx , ( ) => {
291
+ console . log ( `startChannel.runStores: name: ${ name } , method: ${ method } , operation: ${ operation } ` )
285
292
if ( abortController . signal . aborted ) {
286
293
const error = abortController . signal . reason || new Error ( 'Aborted' )
287
294
@@ -319,7 +326,7 @@ function createWrapFunction (prefix = '', override = '') {
319
326
}
320
327
)
321
328
}
322
-
329
+ console . log ( 'finishChannel.runStores(ctx, () => {}): L324' )
323
330
finishChannel . runStores ( ctx , ( ) => { } )
324
331
325
332
return result
0 commit comments