Skip to content

Commit 08ab801

Browse files
committed
feat: dynamically add endEvent uuid for actions with methods
1 parent d5a0dfd commit 08ab801

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { queryElements } from '@cocreate/utils'
2+
import uuid from '@cocreate/uuid'
23

34
const attribute = 'actions'
45
const actions = {}
@@ -77,12 +78,13 @@ function runAction(stagedActions, index, element) {
7778
let name = actionName.split('.')[0]
7879
currentAction.method = actionName.substring(name.length + 1)
7980
currentAction.name = actionName = name
81+
currentAction.endEvent = uuid.generate(6)
8082
}
8183

8284
const action = actions[actionName];
8385

8486
if (action) {
85-
document.addEventListener(action.endEvent, function () {
87+
document.addEventListener(currentAction.endEvent || action.endEvent, function () {
8688
runNextAction(stagedActions, index, element);
8789
}, { once: true });
8890

0 commit comments

Comments
 (0)