Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace use of window.postMessage in card info #3646

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

iamllama
Copy link
Contributor

@iamllama iamllama commented Dec 17, 2024

Sorry for bringing this up again, looked through #3572 and the deck options page and came across existing uses of globalThis.anki

Using it seems more reliable than window.postMessage (from #3621), in that it doesn't need the page to be rendered properly for it to navigate (the onmessage listener is currently added via a component, and cardStats can still throw when the card doesn't exist) and falls back to window.location if goto were to fail

Also added the proposed placeholder format change that was missed out from #3631

EDIT: poor choice of words, postMessage isn't intrisically less reliable than a global fn

@iamllama iamllama marked this pull request as draft December 17, 2024 08:49
@iamllama iamllama marked this pull request as ready for review December 17, 2024 09:17
@abdnh abdnh merged commit b061da7 into ankitects:main Dec 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants