Skip to content

Commit 38e51d5

Browse files
refactor(action-chain): emit events async
1 parent 8f149a0 commit 38e51d5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/node_modules/action-chain/src/ActionBase.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class ActionBase<Effects> {
113113
executionContextWithPath
114114
)
115115

116-
this.actionChain.emit('operator:start', {
116+
this.actionChain.emitAsync('operator:start', {
117117
type,
118118
name,
119119
path,
@@ -122,15 +122,15 @@ export class ActionBase<Effects> {
122122
const result = cb(effects, currentValue)
123123

124124
if (result instanceof Promise) {
125-
this.actionChain.emit('operator:async', {
125+
this.actionChain.emitAsync('operator:async', {
126126
type,
127127
name,
128128
path,
129129
isAsync: true,
130130
...thisExecution,
131131
})
132132
return result.then((promiseResult) => {
133-
this.actionChain.emit('operator:end', {
133+
this.actionChain.emitAsync('operator:end', {
134134
type,
135135
name,
136136
path,
@@ -142,7 +142,7 @@ export class ActionBase<Effects> {
142142
})
143143
}
144144

145-
this.actionChain.emit('operator:end', {
145+
this.actionChain.emitAsync('operator:end', {
146146
type,
147147
name,
148148
path,

packages/node_modules/action-chain/src/ActionChain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class ActionChain<Effects> extends EventEmitter<ActionChainEvents> {
7777
const result = target[prop](...args)
7878
if (result instanceof Promise) {
7979
result.then((promisedResult) => {
80-
instance.emit('provider', {
80+
instance.emitAsync('provider', {
8181
...execution,
8282
name: path,
8383
method: prop,
@@ -86,7 +86,7 @@ export class ActionChain<Effects> extends EventEmitter<ActionChainEvents> {
8686
})
8787
})
8888
} else {
89-
instance.emit('provider', {
89+
instance.emitAsync('provider', {
9090
...execution,
9191
name: path,
9292
method: prop,

0 commit comments

Comments
 (0)