17 lines
330 B
JavaScript
Raw Normal View History

2024-10-25 18:09:59 +08:00
const callbacks = [];
let isTriggered = false;
export default {
addCreatedListener(callback) {
if (isTriggered) {
callback();
}
else {
callbacks.push(callback);
}
},
_triggerCallback() {
isTriggered = true;
callbacks.forEach(v => v());
},
};