diff --git a/.github/workflows/auto-cleanup-bot.yml b/.github/workflows/auto-cleanup-bot.yml index 6707f9fe52c820d..4686bad0ad8d085 100644 --- a/.github/workflows/auto-cleanup-bot.yml +++ b/.github/workflows/auto-cleanup-bot.yml @@ -15,12 +15,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" package-manager-cache: false diff --git a/.github/workflows/interfacedata-updater.yml b/.github/workflows/interfacedata-updater.yml index 1db7a9ecae79513..1d548bfbb3dc5fc 100644 --- a/.github/workflows/interfacedata-updater.yml +++ b/.github/workflows/interfacedata-updater.yml @@ -16,20 +16,20 @@ jobs: steps: - name: Checkout content - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: path: mdn-content ref: main persist-credentials: false - name: Setup node.js - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: "mdn-content/.nvmrc" package-manager-cache: false - name: Checkout webref - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: repository: w3c/webref path: webref diff --git a/.github/workflows/issue-regex-labeler.yml b/.github/workflows/issue-regex-labeler.yml index 0790a0d614ee24b..4da6616e1dad7a4 100644 --- a/.github/workflows/issue-regex-labeler.yml +++ b/.github/workflows/issue-regex-labeler.yml @@ -11,7 +11,7 @@ jobs: issue-labeler: runs-on: ubuntu-latest steps: - - uses: github/issue-labeler@v3.4 + - uses: github/issue-labeler@c1b0f9f52a63158c4adc09425e858e87b32e9685 # v3.4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/issue-regex-labeler.yml diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index f6e24d4f8058b7a..64e0e588d32631d 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -21,12 +21,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check-lint_content.yml b/.github/workflows/pr-check-lint_content.yml index 6a562d17e39f964..ab20711dc889c34 100644 --- a/.github/workflows/pr-check-lint_content.yml +++ b/.github/workflows/pr-check-lint_content.yml @@ -23,7 +23,7 @@ jobs: steps: - name: Checkout BASE - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false @@ -57,7 +57,7 @@ jobs: - name: Checkout HEAD if: steps.check.outputs.HAS_FILES == 'true' - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: ref: ${{ github.event.pull_request.head.sha }} path: pr_head @@ -81,7 +81,7 @@ jobs: - name: Setup Node.js environment if: steps.check.outputs.HAS_FILES == 'true' - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_cspell_lists.yml b/.github/workflows/pr-check_cspell_lists.yml index 83f79c84eeaad05..4b40a0d40e4cb7c 100644 --- a/.github/workflows/pr-check_cspell_lists.yml +++ b/.github/workflows/pr-check_cspell_lists.yml @@ -14,7 +14,7 @@ jobs: docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: sparse-checkout-cone-mode: false sparse-checkout: | @@ -25,7 +25,7 @@ jobs: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" diff --git a/.github/workflows/pr-check_javascript.yml b/.github/workflows/pr-check_javascript.yml index 14f88501ddb09c5..1a112b919941e2e 100644 --- a/.github/workflows/pr-check_javascript.yml +++ b/.github/workflows/pr-check_javascript.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_json.yml b/.github/workflows/pr-check_json.yml index b94c1cf71ffbe1f..b4b49e7c1ec67d5 100644 --- a/.github/workflows/pr-check_json.yml +++ b/.github/workflows/pr-check_json.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_redirects.yml b/.github/workflows/pr-check_redirects.yml index 2f732f788ecc44a..5b5c3db23a91045 100644 --- a/.github/workflows/pr-check_redirects.yml +++ b/.github/workflows/pr-check_redirects.yml @@ -13,12 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_scripts.yml b/.github/workflows/pr-check_scripts.yml index 7faf832eb269247..337163551020d12 100644 --- a/.github/workflows/pr-check_scripts.yml +++ b/.github/workflows/pr-check_scripts.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn @@ -40,12 +40,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn @@ -82,12 +82,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn @@ -104,12 +104,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn @@ -130,12 +130,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_url-issues.yml b/.github/workflows/pr-check_url-issues.yml index 56905a63b80de26..32f8db4a2b7668d 100644 --- a/.github/workflows/pr-check_url-issues.yml +++ b/.github/workflows/pr-check_url-issues.yml @@ -16,13 +16,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-check_yml.yml b/.github/workflows/pr-check_yml.yml index b9e6be6e7add6ff..e004ed4a9263bc0 100644 --- a/.github/workflows/pr-check_yml.yml +++ b/.github/workflows/pr-check_yml.yml @@ -18,12 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index e5e4c00b3f2bcb6..7a38fb366b5d229 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -19,7 +19,7 @@ jobs: name: Label by path runs-on: ubuntu-latest steps: - - uses: actions/labeler@v6 + - uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" sync-labels: true diff --git a/.github/workflows/pr-review-companion.yml b/.github/workflows/pr-review-companion.yml index cfd40e9386207b3..1838df4e269f8b5 100644 --- a/.github/workflows/pr-review-companion.yml +++ b/.github/workflows/pr-review-companion.yml @@ -39,7 +39,7 @@ jobs: STATUS_TARGET: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} steps: - name: Download artifact - uses: actions/download-artifact@v6 + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 with: pattern: build path: build @@ -69,7 +69,7 @@ jobs: - name: Authenticate with GCP if: steps.check.outputs.HAS_ARTIFACT - uses: google-github-actions/auth@v3 + uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 with: token_format: access_token service_account: deploy-mdn-review-content@${{ secrets.GCP_PROJECT_NAME }}.iam.gserviceaccount.com @@ -77,11 +77,11 @@ jobs: - name: Setup gcloud if: steps.check.outputs.HAS_ARTIFACT - uses: google-github-actions/setup-gcloud@v3 + uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 - name: Upload to GCS if: steps.check.outputs.HAS_ARTIFACT - uses: google-github-actions/upload-cloud-storage@v3 + uses: google-github-actions/upload-cloud-storage@6397bd7208e18d13ba2619ee21b9873edc94427a # v3.0.0 with: path: "build" destination: "${{ vars.GCP_BUCKET_NAME }}/${{ steps.check.outputs.PREFIX }}" @@ -93,14 +93,14 @@ jobs: process_gcloudignore: false - name: Checkout (mdn/content) - uses: actions/checkout@v5 + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 if: steps.check.outputs.HAS_ARTIFACT with: path: content persist-credentials: false - name: Setup (mdn/content) - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 if: steps.check.outputs.HAS_ARTIFACT with: node-version-file: "content/.nvmrc" diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index be08b4a0dd03463..cfc962bd2fd2039 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -29,7 +29,7 @@ jobs: BUILD_OUT_ROOT: build steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false @@ -80,7 +80,7 @@ jobs: - name: Setup Node.js environment if: steps.check.outputs.HAS_FILES == 'true' - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" cache: yarn @@ -160,7 +160,7 @@ jobs: if: steps.check.outputs.HAS_MD_FILES == 'true' run: du -sh $BUILD_OUT_ROOT - - uses: actions/upload-artifact@v5 + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 if: steps.check.outputs.HAS_MD_FILES == 'true' with: name: build diff --git a/.github/workflows/spelling-check-bot.yml b/.github/workflows/spelling-check-bot.yml index 5e7928a9ba2f04f..879e4802076d1c9 100644 --- a/.github/workflows/spelling-check-bot.yml +++ b/.github/workflows/spelling-check-bot.yml @@ -18,12 +18,12 @@ jobs: timeout-minutes: 5 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - name: Setup Node.js environment - uses: actions/setup-node@v6 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 with: node-version-file: ".nvmrc" package-manager-cache: false diff --git a/files/en-us/web/api/languagedetector/create_static/index.md b/files/en-us/web/api/languagedetector/create_static/index.md index 84f13f91d964ed3..48553b92c226940 100644 --- a/files/en-us/web/api/languagedetector/create_static/index.md +++ b/files/en-us/web/api/languagedetector/create_static/index.md @@ -30,7 +30,9 @@ LanguageDetector.create(options) - `monitor` {{optional_inline}} - : A callback function with a {{domxref("CreateMonitor")}} argument that enables monitoring download progress of the AI model. - `signal` {{optional_inline}} - - : 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 ongoing and subsequent `LanguageDetector` method calls will reject with an `AbortError`. ### Return value diff --git a/files/en-us/web/api/languagedetector/destroy/index.md b/files/en-us/web/api/languagedetector/destroy/index.md index 60580d8daef70f4..917b653e2e46b78 100644 --- a/files/en-us/web/api/languagedetector/destroy/index.md +++ b/files/en-us/web/api/languagedetector/destroy/index.md @@ -10,7 +10,9 @@ browser-compat: api.LanguageDetector.destroy {{APIRef("Translator and Language Detector APIs")}}{{SeeCompatTable}}{{securecontext_header}} -The **`destroy()`** method of the {{domxref("LanguageDetector")}} interface destroys the `LanguageDetector` instance it is called on. It makes sense to destroy these objects if they are no longer going to be used, as they tie up significant resources in their handling. +The **`destroy()`** method of the {{domxref("LanguageDetector")}} interface releases the resources assigned to the `LanguageDetector` instance it is called on and stops any further activity on it. This means that any ongoing and subsequent method calls made on the `LanguageDetector` will reject with an `AbortError`. + +It makes sense to destroy `LanguageDetector` objects if they are no longer being used, as they tie up significant resources in their handling. ## Syntax diff --git a/files/en-us/web/api/languagedetector/detect/index.md b/files/en-us/web/api/languagedetector/detect/index.md index 99e5493ecc090bc..89e8aa764701a93 100644 --- a/files/en-us/web/api/languagedetector/detect/index.md +++ b/files/en-us/web/api/languagedetector/detect/index.md @@ -43,6 +43,8 @@ The last array element returned will always have a `detectedLanguage` value of ` ### Exceptions +- `AbortError` {{domxref("DOMException")}} + - : Thrown if the `LanguageDetector` was previously destroyed (had {{domxref("LanguageDetector.destroy()")}} called on it, or was aborted via its abort [`signal`](/en-US/docs/Web/API/LanguageDetector/create_static#signal) after creation). - `InvalidStateError` {{domxref("DOMException")}} - : Thrown if the current {{domxref("Document")}} is not active. - {{domxref("QuotaExceededError")}} diff --git a/files/en-us/web/api/languagedetector/index.md b/files/en-us/web/api/languagedetector/index.md index 41781048cf5a7a1..58f4f71c8a66435 100644 --- a/files/en-us/web/api/languagedetector/index.md +++ b/files/en-us/web/api/languagedetector/index.md @@ -30,7 +30,7 @@ The **`LanguageDetector`** interface of the {{domxref("Translator and Language D ## Instance methods - {{domxref("LanguageDetector.destroy", "destroy()")}} {{Experimental_Inline}} - - : Destroys the `LanguageDetector` instance it is called on. + - : Releases the resources assigned to the `LanguageDetector` instance it is called on and stops any further activity on it. - {{domxref("LanguageDetector.detect", "detect()")}} {{Experimental_Inline}} - : Detects the closest matching language or languages that a given text string is most likely to be written in. - {{domxref("LanguageDetector.measureInputUsage", "measureInputUsage()")}} {{Experimental_Inline}} diff --git a/files/en-us/web/api/summarizer/create_static/index.md b/files/en-us/web/api/summarizer/create_static/index.md index 12ed0fc77abafc0..82ee349a8c58c5f 100644 --- a/files/en-us/web/api/summarizer/create_static/index.md +++ b/files/en-us/web/api/summarizer/create_static/index.md @@ -41,7 +41,9 @@ Summarizer.create(options) - `sharedContext` - : A {{domxref("Summarizer.sharedContext", "sharedContext")}} string describing the context the pieces of text to summarize are being used in, which helps the `Summarizer` generate more suitable summaries. - `signal` - - : 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("Summarizer.destroy()")}}: The resources assigned to the resulting `Summarizer` instance are released, and any ongoing and subsequent `Summarizer` method calls will reject with an `AbortError`. - `type` - : An enumerated value specifying the {{domxref("Summarizer.type", "type")}} of summary you want this `Summarizer` to generate. Defaults to `key-points`. diff --git a/files/en-us/web/api/summarizer/destroy/index.md b/files/en-us/web/api/summarizer/destroy/index.md index 4c1a88fb22dda59..992681daef41918 100644 --- a/files/en-us/web/api/summarizer/destroy/index.md +++ b/files/en-us/web/api/summarizer/destroy/index.md @@ -10,7 +10,9 @@ browser-compat: api.Summarizer.destroy {{APIRef("Summarizer API")}}{{SeeCompatTable}}{{securecontext_header}} -The **`destroy()`** method of the {{domxref("Summarizer")}} interface destroys the `Summarizer` instance it is called on. It makes sense to destroy `Summarizer` objects if they are no longer going to be used, as they tie up significant resources in their handling. +The **`destroy()`** method of the {{domxref("Summarizer")}} interface releases the resources assigned to the `Summarizer` instance it is called on and stops any further activity on it. This means that any ongoing and subsequent method calls made on the `Summarizer` will reject with an `AbortError`. + +It makes sense to destroy `Summarizer` objects if they are no longer being used, as they tie up significant resources in their handling. ## Syntax diff --git a/files/en-us/web/api/summarizer/index.md b/files/en-us/web/api/summarizer/index.md index 26d08cfb4cf26c8..3598659f48cb38c 100644 --- a/files/en-us/web/api/summarizer/index.md +++ b/files/en-us/web/api/summarizer/index.md @@ -42,7 +42,7 @@ The **`Summarizer`** interface of the {{domxref("Summarizer API", "Summarizer AP ## Instance methods - {{domxref("Summarizer.destroy", "destroy()")}} {{Experimental_Inline}} - - : Destroys the `Summarizer` instance it is called on. + - : Releases the resources assigned to the `Summarizer` instance it is called on and stops any further activity on it. - {{domxref("Summarizer.measureInputUsage", "measureInputUsage()")}} {{Experimental_Inline}} - : Reports how much input quota would be used by a summarize operation for a given text input. - {{domxref("Summarizer.summarize", "summarize()")}} {{Experimental_Inline}} diff --git a/files/en-us/web/api/summarizer/summarize/index.md b/files/en-us/web/api/summarizer/summarize/index.md index d8cc40c6558101b..5ba01ee94013a05 100644 --- a/files/en-us/web/api/summarizer/summarize/index.md +++ b/files/en-us/web/api/summarizer/summarize/index.md @@ -36,6 +36,8 @@ A {{jsxref("Promise")}} that fulfills with a string containing the generated sum ### Exceptions +- `AbortError` {{domxref("DOMException")}} + - : Thrown if the `Summarizer` was previously destroyed (had {{domxref("Summarizer.destroy()")}} called on it, or was aborted via its abort [`signal`](/en-US/docs/Web/API/Summarizer/create_static#signal) after creation). - `InvalidStateError` {{domxref("DOMException")}} - : Thrown if the current {{domxref("Document")}} is not active. - `NotAllowedError` {{domxref("DOMException")}} diff --git a/files/en-us/web/api/summarizer/summarizestreaming/index.md b/files/en-us/web/api/summarizer/summarizestreaming/index.md index a8b6e117758a653..1eece4b5460ef23 100644 --- a/files/en-us/web/api/summarizer/summarizestreaming/index.md +++ b/files/en-us/web/api/summarizer/summarizestreaming/index.md @@ -36,6 +36,8 @@ A {{domxref("ReadableStream")}} containing the generated summary. ### Exceptions +- `AbortError` {{domxref("DOMException")}} + - : Thrown if the `Summarizer` was previously destroyed (had {{domxref("Summarizer.destroy()")}} called on it, or was aborted via its abort [`signal`](/en-US/docs/Web/API/Summarizer/create_static#signal) after creation). - `InvalidStateError` {{domxref("DOMException")}} - : Thrown if the current {{domxref("Document")}} is not active. - `NotAllowedError` {{domxref("DOMException")}} diff --git a/files/en-us/web/api/summarizer_api/index.md b/files/en-us/web/api/summarizer_api/index.md index 9c1150ce14aa3f3..ef1d98dca57f639 100644 --- a/files/en-us/web/api/summarizer_api/index.md +++ b/files/en-us/web/api/summarizer_api/index.md @@ -29,7 +29,9 @@ This is done using the functionality made available by the {{domxref("Summarizer > If you want to check whether the browser AI model is able to support your preferences, you can do so with the {{domxref("Summarizer.availability_static", "Summarizer.availability()")}} static method. 2. Run the {{domxref("Summarizer.summarize()")}} instance method to request the summary. -After a `Summarizer` instance has been created, you can remove it again using the {{domxref("Summarizer.destroy()")}} instance method. You can also cancel a pending `create()` or `summarize()` operation using an {{domxref("AbortController")}}. +You can cancel a pending `create()` or `summarize()` operation using an {{domxref("AbortController")}}. + +After a `Summarizer` instance has been created, you can release its assigned resources and stop any further activity by calling its {{domxref("Summarizer.destroy()")}} method. You are encouraged to do this after you've finished with the `Summarizer` object as it can consume a lot of resources. See [Using the Summarizer API](/en-US/docs/Web/API/Summarizer_API/Using) for a walkthrough of how the API works. diff --git a/files/en-us/web/api/summarizer_api/using/index.md b/files/en-us/web/api/summarizer_api/using/index.md index 720a50361c85833..952341f009d2c88 100644 --- a/files/en-us/web/api/summarizer_api/using/index.md +++ b/files/en-us/web/api/summarizer_api/using/index.md @@ -83,11 +83,9 @@ console.log("Stream complete"); summaryOutput.textContent = summary; ``` -After a `Summarizer` instance has been created, you can remove it again using the {{domxref("Summarizer.destroy()")}} instance method. It makes sense to destroy `Summarizer` objects if they are no longer going to be used, as they tie up significant resources in their handling. +## Cancelling operations and destroying instances -## Cancelling summarize operations - -You can cancel a pending `create()`, `summarize()`, or `summarizeStreaming()` operation using an {{domxref("AbortController")}}: +You can cancel a pending `create()`, `summarize()`, or `summarizeStreaming()` operation using an {{domxref("AbortController")}}, with the associated {{domxref("AbortSignal")}} being included inside the method options object as a `signal` property value. For example, aborting a `Summarizer.create()` operation would look like this: ```js const controller = new AbortController(); @@ -100,6 +98,14 @@ const summary = await summarizer.summarize(myTextString, { controller.abort(); ``` +After a `Summarizer` instance has been created, you can release its assigned resources and stop any further activity by calling its {{domxref("Summarizer.destroy()")}} method. You are encouraged to do this after you've finished with the `Summarizer` object as it can consume a lot of resources. + +```js +summarizer.destroy(); +``` + +If a `create()` call has an associated {{domxref("AbortController")}}, and you call its {{domxref("AbortController.abort()")}} method after the `create()` call has succeeded, it will have the same effect as calling `destroy()` on the resulting `Summarizer` object. + ## Monitoring download progress If the AI model for a particular summarizer is downloading (`availability()` returns `downloadable` and `downloading`), it is helpful to provide the user with feedback to tell them how long they need to wait before the operation completes. diff --git a/files/en-us/web/api/translator/create_static/index.md b/files/en-us/web/api/translator/create_static/index.md index 81dbb31fb619adf..0293119879bf365 100644 --- a/files/en-us/web/api/translator/create_static/index.md +++ b/files/en-us/web/api/translator/create_static/index.md @@ -32,7 +32,9 @@ Translator.create(options) - `monitor` {{optional_inline}} - : A callback function with a {{domxref("CreateMonitor")}} argument that enables monitoring download progress of the AI model. - `signal` {{optional_inline}} - - : 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("Translator.destroy()")}}: The resources assigned to the resulting `Translator` instance are released, and any ongoing and subsequent `Translator` method calls will reject with an `AbortError`. ### Return value diff --git a/files/en-us/web/api/translator/destroy/index.md b/files/en-us/web/api/translator/destroy/index.md index 5d382c4d38cfb7a..08c5fd01aa59213 100644 --- a/files/en-us/web/api/translator/destroy/index.md +++ b/files/en-us/web/api/translator/destroy/index.md @@ -10,7 +10,9 @@ browser-compat: api.Translator.destroy {{APIRef("Translator and Language Detector APIs")}}{{SeeCompatTable}} {{securecontext_header}} -The **`destroy()`** method of the {{domxref("Translator")}} interface destroys the `Translator` instance it is called on. It makes sense to destroy these objects if they are no longer going to be used, as they tie up significant resources in their handling. +The **`destroy()`** method of the {{domxref("Translator")}} interface releases the resources assigned to the `Translator` instance it is called on and stops any further activity on it. This means that any ongoing and subsequent method calls made on the `Translator` will reject with an `AbortError`. + +It makes sense to destroy `Translator` objects if they are no longer being used, as they tie up significant resources in their handling. ## Syntax diff --git a/files/en-us/web/api/translator/index.md b/files/en-us/web/api/translator/index.md index 365cb4355c9fd58..c81111165e574c8 100644 --- a/files/en-us/web/api/translator/index.md +++ b/files/en-us/web/api/translator/index.md @@ -32,7 +32,7 @@ The **`Translator`** interface of the {{domxref("Translator and Language Detecto ## Instance methods - {{domxref("Translator.destroy", "destroy()")}} {{Experimental_Inline}} - - : Destroys the `Translator` instance it is called on. + - : Releases the resources assigned to the `Translator` instance it is called on and stops any further activity on it. - {{domxref("Translator.measureInputUsage", "measureInputUsage()")}} {{Experimental_Inline}} - : Reports how much input quota would be used by a translation operation for a given text input. - {{domxref("Translator.translate", "translate()")}} {{Experimental_Inline}} diff --git a/files/en-us/web/api/translator/translate/index.md b/files/en-us/web/api/translator/translate/index.md index 61320b7ea329751..b882c05098f5af4 100644 --- a/files/en-us/web/api/translator/translate/index.md +++ b/files/en-us/web/api/translator/translate/index.md @@ -34,6 +34,8 @@ A {{jsxref("Promise")}} that fulfills with a string containing the generated tra ### Exceptions +- `AbortError` {{domxref("DOMException")}} + - : Thrown if the `Translator` was previously destroyed (had {{domxref("Translator.destroy()")}} called on it, or was aborted via its abort [`signal`](/en-US/docs/Web/API/Translator/create_static#signal) after creation). - `InvalidStateError` {{domxref("DOMException")}} - : Thrown if the current {{domxref("Document")}} is not active. - {{domxref("QuotaExceededError")}} diff --git a/files/en-us/web/api/translator/translatestreaming/index.md b/files/en-us/web/api/translator/translatestreaming/index.md index 628da378e210f8a..61a68f8ff21e6e7 100644 --- a/files/en-us/web/api/translator/translatestreaming/index.md +++ b/files/en-us/web/api/translator/translatestreaming/index.md @@ -34,6 +34,8 @@ A {{domxref("ReadableStream")}} containing the generated translation. ### Exceptions +- `AbortError` {{domxref("DOMException")}} + - : Thrown if the `Translator` was previously destroyed (had {{domxref("Translator.destroy()")}} called on it, or was aborted via its abort [`signal`](/en-US/docs/Web/API/Translator/create_static#signal) after creation). - `InvalidStateError` {{domxref("DOMException")}} - : Thrown if the current {{domxref("Document")}} is not active. - {{domxref("QuotaExceededError")}} diff --git a/files/en-us/web/api/translator_and_language_detector_apis/index.md b/files/en-us/web/api/translator_and_language_detector_apis/index.md index 84d742da42cb249..410c6d88aac1498 100644 --- a/files/en-us/web/api/translator_and_language_detector_apis/index.md +++ b/files/en-us/web/api/translator_and_language_detector_apis/index.md @@ -27,9 +27,9 @@ AI is well-suited to facilitating language detection and translation. The Transl - Language detection is done via the {{domxref("LanguageDetector")}} interface. A `LanguageDetector` object instance is created using the {{domxref("LanguageDetector.create_static", "LanguageDetector.create()")}} static method, then the {{domxref("LanguageDetector.detect", "detect()")}} instance method is passed the text string to detect the language for. - Translation is done via the {{domxref("Translator")}} interface. A `Translator` object instance is created using the {{domxref("Translator.create_static", "Translator.create()")}} static method, then the {{domxref("Translator.translate", "translate()")}} instance method is passed the text string to translate. -You can also cancel pending operations using an {{domxref("AbortController")}}. +You can cancel a pending `create()`, `detect()`, or `translate()` operation using an {{domxref("AbortController")}}. -The `Translator` and `LanguageDetector` instances consume a lot of resources, so once you're finished with them, you are encouraged to remove them using a `destroy()` instance method (for example, {{domxref("Translator.destroy()")}}). +After a `LanguageDetector` or `Translator` instance has been created, you can release its assigned resources and stop any further activity by calling its {{domxref("LanguageDetector.destroy()")}}/{{domxref("Translator.destroy()")}} method. You are encouraged to do this after you've finished with the object as it can consume a lot of resources. See [Using the Translator and Language Detector APIs](/en-US/docs/Web/API/Translator_and_Language_Detector_APIs/Using) for a walkthrough of how to use the APIs. diff --git a/files/en-us/web/api/translator_and_language_detector_apis/using/index.md b/files/en-us/web/api/translator_and_language_detector_apis/using/index.md index 8287b371c98ce91..7e4584e597cfda4 100644 --- a/files/en-us/web/api/translator_and_language_detector_apis/using/index.md +++ b/files/en-us/web/api/translator_and_language_detector_apis/using/index.md @@ -131,14 +131,14 @@ const translator = await Translator.create({ controller.abort(); ``` -Once a `Translator` or `LanguageDetector` instance has been created, you can destroy it when it is finished with using the {{domxref("Translator.destroy()")}}/{{domxref("LanguageDetector.destroy()")}} methods: +After a `LanguageDetector` or `Translator` instance has been created, you can release its assigned resources and stop any further activity by calling its {{domxref("LanguageDetector.destroy()")}}/{{domxref("Translator.destroy()")}} method. You are encouraged to do this after you've finished with the object as it can consume a lot of resources. ```js translator.destroy(); detector.destroy(); ``` -It makes sense to destroy these objects if they are no longer going to be used, as they tie up significant resources in their handling. +If a `create()` call has an associated {{domxref("AbortController")}}, and you call its {{domxref("AbortController.abort()")}} method after the `create()` call has succeeded, it will have the same effect as calling `destroy()` on the resulting `LanguageDetector` or `Translator` object. ## Monitoring download progress