or Create a profile
Beta Testing →
17 Jan, 2020 04:35 AM
Anki 2.1.20 introduces a new hook system that allows for better code completion and type checking than the old system. For a short explanation and link to some sample add-ons, please see https://apps.ankiweb.net/docs/addons.html#new-hooks
Add-ons using the old hooks should continue to work, as the new hooks will automatically call the old hooks in most cases, and a few runHook/runFilter calls have been left in the codebase in the places where the new hooks differ significantly from the old ones.
There are a bunch of hooks that previously were called with no arguments, such as when a new deck is created. The new hooks will tend to pass the newly created item into the callback, but will not do so for the legacy hooks, to avoid breaking old code.
If anyone has feedback on the naming or the arguments of the new hooks, please let me know during the beta testing period, so they can be changed prior to add-on authors relying on them.
To go along with these changes, the policy on adding new hooks has also changed. In the past, Anki's add-on documentation suggested hooks were best left for code paths that multiple add-ons wanted to extend, but this resulted in an over-reliance on monkey patching, and has made things fragile. The add-on documentation has been updated to encourage add-on authors to submit pull requests for any hooks they need, and the hope is that the bulk of add-ons can move away from monkey patching in the future.
Formatting help /
(switch to plain text)
(switch to Markdown)
You can attach files up to 10MB
If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.
A conversation has been started with the Anki staff to resolve this discussion.
This discussion is private.
Only you and Anki support staff can see and reply to it.
This discussion is public. Everyone can see and reply to it.
You can use Command ⌘ instead of Control ^ on Mac
Powered by Tender™.