From ebd6de7f8140b299ddf2bfaa35c1e0252151c303 Mon Sep 17 00:00:00 2001 From: Fina <42113148+BSPR0002@users.noreply.github.com> Date: Mon, 6 Nov 2023 16:56:38 +0800 Subject: [PATCH] Correct descriptions of the asynchronous iterator methods on `FileSystemDirectoryHandle` (#29012) * Correct descriptions * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix typo * Update files/en-us/web/api/filesystemdirectoryhandle/keys/index.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * delete line breaks in list * improve * improve * Apply suggestions from code review Co-authored-by: Florian Scholz --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Florian Scholz --- .../api/filesystemdirectoryhandle/entries/index.md | 13 +++++++------ .../web/api/filesystemdirectoryhandle/keys/index.md | 9 ++++++--- .../api/filesystemdirectoryhandle/values/index.md | 10 ++++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/files/en-us/web/api/filesystemdirectoryhandle/entries/index.md b/files/en-us/web/api/filesystemdirectoryhandle/entries/index.md index a839acf21246f2b..c676006296352f9 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/entries/index.md +++ b/files/en-us/web/api/filesystemdirectoryhandle/entries/index.md @@ -9,10 +9,10 @@ browser-compat: api.FileSystemDirectoryHandle.entries {{securecontext_header}}{{APIRef("File System API")}} The **`entries()`** method of the -{{domxref("FileSystemDirectoryHandle")}} interface returns an array of a given object's -own enumerable property `[key, value]` pairs, in the same order as that -provided by a [`for...in`](/en-US/docs/Web/JavaScript/Reference/Statements/for...in) loop (the difference being that a for-in loop -enumerates properties in the prototype chain as well). +{{domxref("FileSystemDirectoryHandle")}} interface returns a new asynchronous iterator +for the iteration of the key-value pairs of the entries within the `FileSystemDirectoryHandle` +on which this method is called. The key-value pairs are +in the form of an array like `[key, value]`. ## Syntax @@ -26,11 +26,12 @@ None. ### Return value -An array of the given `FileSystemDirectoryHandle` object's own enumerable -property `[key, value]` pairs. +A new asynchronous iterator containing the key-value pairs of each entry within the `FileSystemDirectoryHandle`. ## Examples +Use the `for await...of` loop can simplify the iteration process. + ```js const dirHandle = await window.showDirectoryPicker(); diff --git a/files/en-us/web/api/filesystemdirectoryhandle/keys/index.md b/files/en-us/web/api/filesystemdirectoryhandle/keys/index.md index 841951d2bff18d1..8ae4fe9906bd9a8 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/keys/index.md +++ b/files/en-us/web/api/filesystemdirectoryhandle/keys/index.md @@ -9,8 +9,9 @@ browser-compat: api.FileSystemDirectoryHandle.keys {{securecontext_header}}{{APIRef("File System API")}} The **`keys()`** method of the -{{domxref("FileSystemDirectoryHandle")}} interface returns a new _array iterator_ -containing the keys for each item in `FileSystemDirectoryHandle`. +{{domxref("FileSystemDirectoryHandle")}} interface returns a new asynchronous iterator +for the iteration of the key of the entries within the `FileSystemDirectoryHandle` +on which this method is called. ## Syntax @@ -24,10 +25,12 @@ None. ### Return value -A new {{jsxref('Array')}} +A new asynchronous iterator containing the keys of each entry within the `FileSystemDirectoryHandle`. ## Examples +Use the `for await...of` loop can simplify the iteration process. + ```js const dirHandle = await window.showDirectoryPicker(); diff --git a/files/en-us/web/api/filesystemdirectoryhandle/values/index.md b/files/en-us/web/api/filesystemdirectoryhandle/values/index.md index 51bb6d016ff308f..ef52535d2998073 100644 --- a/files/en-us/web/api/filesystemdirectoryhandle/values/index.md +++ b/files/en-us/web/api/filesystemdirectoryhandle/values/index.md @@ -9,9 +9,9 @@ browser-compat: api.FileSystemDirectoryHandle.values {{securecontext_header}}{{APIRef("File System API")}} The **`values()`** method of the -{{domxref("FileSystemDirectoryHandle")}} interface returns a new _array iterator_ -containing the values for each index in the `FileSystemDirectoryHandle` -object. +{{domxref("FileSystemDirectoryHandle")}} interface returns a new asynchronous iterator +for the iteration of the value of the entries within the `FileSystemDirectoryHandle` +on which this method is called. ## Syntax @@ -25,10 +25,12 @@ None. ### Return value -A new {{jsxref('Array')}} +A new asynchronous iterator containing the handles of each entry within the `FileSystemDirectoryHandle`. ## Examples +Use the `for await...of` loop can simplify the iteration process. + ```js const dirHandle = await window.showDirectoryPicker();