Skip to content

Conversation

@chrisdavidmills
Copy link
Contributor

Description

As per #41610, the information on our AI API documentation pages relating to destroy()/abort() is not accurate. This PR aims to fix this issue.

cc @nathanmemmott. Can you give this a tech review?

Motivation

Additional details

Related issues and pull requests

Fixes #41610

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner October 27, 2025 17:37
@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Oct 27, 2025
Copy link

@nathanmemmott nathanmemmott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you this looks good to me with one comment!

- : An {{domxref("AbortSignal")}} object instance, which allows the `create()` operation to be aborted via the associated {{domxref("AbortController")}}.
- : An {{domxref("AbortSignal")}} object instance, which allows a `create()` operation to be aborted via the associated {{domxref("AbortController")}}. The exact effect is dependant on when {{domxref("AbortController.abort()")}} is called:
- If `abort()` is called before the `create()` promise resolves, the `create()` operation is cancelled.
- If `abort()` is called after the `create()` promise fulfills, it has the same effect as calling {{domxref("LanguageDetector.destroy()")}}: The resources assigned to the resulting `LanguageDetector` instance are released, and any further language detection activity will fail.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any further language detection activity will fail.

Here and elsewhere, I wonder if we should explain what this means? That ongoing calls will reject, as well as any further calls.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @nathanmemmott, this is a good point. I have spelled out explicitly what this means on the destroy() pages, and the create() page signal descriptions. I don't think I need to say more on the summary pages, as it is easy to click through to one of the ref pages if you want to know more.

@sideshowbarker sideshowbarker removed the request for review from a team October 28, 2025 07:49
Copy link
Member

@pepelsbey pepelsbey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you :)

@chrisdavidmills chrisdavidmills merged commit f91ff68 into mdn:main Oct 28, 2025
8 checks passed
@chrisdavidmills chrisdavidmills deleted the fix-ai-api-abort-destroy-descriptions branch October 28, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translator.create's signal option has incomplete description

3 participants