Damien Elmes
3287e8c057
pass in a progress callback instead of http_data_did_[send|receive]
...
If a request is happening on a background thread, the GUI code
receiving requests on that thread can lead to a crash
Add-on downloading still to do.
2020-01-18 17:49:59 +10:00
Damien Elmes
2a0b480103
add context to card rendering, and rework related hooks
...
- the context exists for the lifecycle of one card's render,
and caches calls to things like .card() to avoid add-ons needing to
do their own cache management.
- add-ons can optionally add extra data to the context if they need
it across multiple filters
- removed card_will_render. the legacy hook is still available for
now
- card_did_render is now called only once, with both front and back
text
2020-01-17 09:30:42 +10:00
Damien Elmes
b09e7e8247
more tweaks for readability/consistency
2020-01-15 17:45:35 +10:00
Damien Elmes
237c0791f8
more hook tweaks, and merge the pre-render field and template hooks
2020-01-15 17:18:11 +10:00
Damien Elmes
cab572b63c
remove _hook/_filter suffix
2020-01-15 16:53:24 +10:00
Damien Elmes
b2f756f1b7
tweak the hook names in anki/
...
still a work in progress
2020-01-15 16:43:22 +10:00
Damien Elmes
26cb9851b4
idempotent hook removal
...
This matches remHook()'s behaviour
2020-01-15 13:16:43 +10:00
Damien Elmes
f021d616dd
add optional docstring to hooks
2020-01-15 12:14:32 +10:00
Damien Elmes
c67aefa3ea
move hook gen code out of anki/
...
It's not needed at runtime, and this allows hooks to be updated
even when the code is broken.
2020-01-15 09:11:20 +10:00
Damien Elmes
33bf4c204b
add hook to modify template prior to rendering
2020-01-13 21:57:15 +10:00
Damien Elmes
d266dcd076
add a flag to handle the legacy hook missing args case
...
And update a few more hooks.
2020-01-13 18:37:08 +10:00
Damien Elmes
b86ae31907
update the rest of the anki/ hooks/filters
2020-01-13 17:59:52 +10:00
Damien Elmes
4bb3d7a958
add separate file for gui hooks
2020-01-13 14:38:05 +10:00
Damien Elmes
dd61389319
New type-safe approach to hooks/filters
...
Still todo:
- Add separate module for GUI hooks
- Update the remaining runHook/runFilter() calls
- Document the changes, including defensive registration
2020-01-13 13:57:51 +10:00