feat(VocabPracticeDialog, VocabCourseView): implement event dispatch for hard vocabulary changes
All checks were successful
Deploy to production / deploy (push) Successful in 1m55s
All checks were successful
Deploy to production / deploy (push) Successful in 1m55s
- Added event dispatching for 'yourpart:hardvocab:changed' in both VocabPracticeDialog and VocabCourseView components to notify changes in hard vocabulary items. - Implemented event handling in VocabCourseView to refresh the hard vocabulary list when the event is triggered, ensuring UI consistency across components. - Included error handling for environments that do not support CustomEvent, enhancing robustness.
This commit is contained in:
@@ -339,6 +339,16 @@ export default {
|
||||
} catch (_) {
|
||||
// ignore quota/private-mode issues
|
||||
}
|
||||
try {
|
||||
window.dispatchEvent(new CustomEvent('yourpart:hardvocab:changed', {
|
||||
detail: {
|
||||
courseId: this.openParams?.courseId || null,
|
||||
storageKey: key
|
||||
}
|
||||
}));
|
||||
} catch (_) {
|
||||
// ignore environments without CustomEvent
|
||||
}
|
||||
},
|
||||
getHardKey(item) {
|
||||
const learning = this.normalize(item?.learning || '');
|
||||
|
||||
Reference in New Issue
Block a user