[sample] Sharing data between JavaScript and Python. ex)reviewer.card.id

AnkiWeb addon 1469353108

Explains simple ways to share data between JavaScript and Python, using mw.web.eval to pass variables, window.localStorage to keep them, and mw.web.evalWithCallback to retrieve values.
AI-generated summary; may contain mistakes.

developer-toolsno-description

Open on AnkiWeb Find alternatives

AnkiWeb

Votes
0 (πŸ‘ 0 Β· πŸ‘Ž 0)
Updated
2023-05-13
Anki versions
2.1.58~
License
Not found (this does not mean that the addon has no license)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python
Description language
en

Maintenance

abandoned

  • Last update or commit: 2023-05-13 (1268 days before the snapshot).

GitHub

No GitHub repository linked.

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.502.1.58+2023-05-13
History across monthly snapshots

Loading…

Similar addons

Custom editor keymap

Customizes editor keyboard shortcuts to insert characters, HTML, JavaScript, or file contents based on configured key-and-modifier mappings, including Arrow+Alt symbols.

shortcutsobsolete

1 votes 21% approval πŸ‘ 1 Β· πŸ‘Ž 0 Anki 2.1.46~ Updated 2021-10-13

Description

In JavaScript, there are times when you want to use some variables used in Anki. For example,) reviewer . card . id . However, sharing data between JavaScript and Python is not as simple as you might think. There are several ways to do this, but the following method is simple. Use the mw.web.eval function in Python to pass variables to JavaScript. If you have variables that you want to keep, use window.localStorage. If you want to get the value of a JavaScript variable, use mw.web.evalWithCallback.