File tree Expand file tree Collapse file tree 5 files changed +19
-11
lines changed Expand file tree Collapse file tree 5 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1+ import { AsyncCommand , AsyncMacroCommand } from './puremvc-async-command.js' ;
2+
3+ export {
4+ AsyncCommand ,
5+ AsyncMacroCommand
6+ }
Original file line number Diff line number Diff line change @@ -161,24 +161,25 @@ class AsyncMacroCommand extends puremvc.Notifier
161161 */
162162 nextCommand ( )
163163 {
164- if ( this . subCommands . length > 0 )
164+ if ( this . subCommands ? .length > 0 )
165165 {
166166 const factory = this . subCommands . shift ( ) ;
167167 const instance = factory ( ) ;
168168 let isAsync = ( instance ?. isAsync === true ) ;
169- if ( isAsync ) instance . setOnComplete ( this . nextCommand ) ;
169+ if ( isAsync ) instance . setOnComplete ( ( ) => this . nextCommand ( ) ) ;
170170 instance . initializeNotifier ( this . multitonKey ) ;
171171 instance . execute ( this . note ) ;
172172 if ( ! isAsync ) this . nextCommand ( ) ;
173173 } else {
174- if ( this . onComplete !== null ) this . onComplete ( ) ;
175- this . note = null ;
174+ if ( this ? .onComplete ) this . onComplete ( ) ;
175+ this . note = null ;
176176 this . onComplete = null ;
177177 }
178178 }
179179
180180 note ; // Notification
181181 subCommands ; // Array of command subcommand factories
182+ onComplete ; // Optional function to call when the AsyncMacro completes
182183 isAsync = true ; // simplest workaround to lack of interfaces
183184}
184185
Original file line number Diff line number Diff line change 11{
22 "name" : " @puremvc/puremvc-js-util-async-command" ,
3- "version" : " 1.0.2 " ,
3+ "version" : " 1.0.5 " ,
44 "description" : " PureMVC JS MultiCore Async Command Utility" ,
55 "main" : " bin/index.js" ,
66 "type" : " module" ,
99 "url" : " https://github.com/PureMVC/puremvc-js-util-async-command.git"
1010 },
1111 "scripts" : {
12- "build" : " npm run clean && npm run build:lib" ,
12+ "build" : " npm run clean && npm run build:lib && cp build/index.js bin/ " ,
1313 "build:lib" : " rollup -c build/rollup.conf.mjs" ,
1414 "build:doc" : " jsdoc -c build/jsdoc.json" ,
1515 "clean" : " rm -rf bin" ,
Original file line number Diff line number Diff line change @@ -118,23 +118,24 @@ export class AsyncMacroCommand extends puremvc.Notifier
118118 */
119119 nextCommand ( )
120120 {
121- if ( this . subCommands . length > 0 )
121+ if ( this . subCommands ? .length > 0 )
122122 {
123123 const factory = this . subCommands . shift ( ) ;
124124 const instance = factory ( ) ;
125125 let isAsync = ( instance ?. isAsync === true ) ;
126- if ( isAsync ) instance . setOnComplete ( this . nextCommand ) ;
126+ if ( isAsync ) instance . setOnComplete ( ( ) => this . nextCommand ( ) ) ;
127127 instance . initializeNotifier ( this . multitonKey ) ;
128128 instance . execute ( this . note ) ;
129129 if ( ! isAsync ) this . nextCommand ( ) ;
130130 } else {
131- if ( this . onComplete !== null ) this . onComplete ( ) ;
132- this . note = null ;
131+ if ( this ? .onComplete ) this . onComplete ( ) ;
132+ this . note = null ;
133133 this . onComplete = null ;
134134 }
135135 }
136136
137137 note ; // Notification
138138 subCommands ; // Array of command subcommand factories
139+ onComplete ; // Optional function to call when the AsyncMacro completes
139140 isAsync = true ; // simplest workaround to lack of interfaces
140141}
You can’t perform that action at this time.
0 commit comments