rework reviewer.ts
- Dominant language
- Rust
- Stars
- 30.5k
- Forks
- 3.2k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 60
Description
reviewer.ts could do with an update at one point, and it would be best if we can make any changes to it in one go, instead of trickling out breaking changes over time. This issue is for discussing and tracking what needs to be done.
Some things that should probably be addressed:
- [ ] as mentioned on #1119, we should probably remove the opacity changes and the promise race
- [ ] moving away from Python style _underscorePrefixed() functions, and instead explicitly exporting our public API. We could use an approach like editor/index_wrapper.ts, or maybe we should consider exporting them into a single global, like `anki` or `anki.reviewer`?
- [ ] _updateQA() and the hook system could use a rethink - we no longer need to fade in and out, and the current mix of promises and hooks is a bit tricky to follow - could it be simplified perhaps? onShownHook and onUpdateHook were exposed to allow templates to perform different actions before the content was revealed and after it was revealed, but without an opacity change, perhaps one of them is redundant?
- [ ] should we perhaps pass the MathJax and image promises to hooks in an object, so they can call .then() on them if they want to?
- [ ] @glutanimate has requested a permanent hook that doesn't get reset on each card load. The behaviour can be emulated by injecting the same hook each load via the Python API, but perhaps it's worth considering adding a separate long-lived one as well, which would get spread into the per-card one.
- [ ] move the code into ts/, and make it easy to import into another file (#1008)
Thoughts? Any other things that could do with a change?
Contributor guide
Assessment
This issue has not been assessed yet.