Skip to content

非同期処理の追加 (新セクション作成後移動) #507

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

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

aster-void
Copy link
Contributor

No description provided.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 23, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: be3167e
Status: ✅  Deploy successful!
Preview URL: https://918e5a19.utcode-learn.pages.dev
Branch Preview URL: https://write-promise.utcode-learn.pages.dev

View logs

@aster-void aster-void changed the title 非同期処理 追加 非同期処理の追加 Oct 23, 2023
@aster-void aster-void requested review from chelproc and chvmvd October 23, 2023 08:43
@aster-void
Copy link
Contributor Author

クロージャの話も入れた方がいいですかね?重要ですが、知らなくても理解できそうなので省きましたが
(よく理解してないだけ)

Copy link
Contributor

@chelproc chelproc left a comment

Choose a reason for hiding this comment

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

お疲れ様です!!

最初のほうは力を使ってる感があるのですが最後のほう適当になってません??

Comment on lines 276 to 277
主に第一引数を `resolve`、第二引数を `reject` と命名した無名関数が渡されます。
`Promise` が成功した時には `resolve`、失敗した時には `reject` にそれぞれ結果を渡して関数実行されます。
Copy link
Contributor

Choose a reason for hiding this comment

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

  • 関数のインターフェースの説明で「主に」は曖昧過ぎます。
  • resolve と reject が関数であることが説明できていません。
  • 「結果を渡して関数実行」はどういう意味でしょうか?

`then` メソッドは、引数にコールバック関数を 1 つとり、`Promise` オブジェクトの `PromiseState` が `fulfilled` になった後 (つまり `resolve` 関数が実行された後)にコールバック関数を実行します。
コールバック関数の引数には `PromiseResult` が渡されます。

`then` メソッドは、`PromiseState` が `fulfilled`、`PromiseResult` がコールバック関数の返り値である新しい `Promise` オブジェクトを生成して返します。そのため、メソッドチェーンのような書き方をすることができます。
Copy link
Contributor

Choose a reason for hiding this comment

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

「メソッドチェーン」は初出

@aster-void
Copy link
Contributor Author

いま思いついたんですけど、Promiseオブジェクトだけ先に持ってきてメソッド群をasync/awaitの後に持ってくるのが1番分かりやすそうなので、明日移動します。
例はfsライブラリがいいかな

@aster-void aster-void changed the title 非同期処理の追加 非同期処理の追加 (新セクション作成後移動してマージ) Dec 16, 2023
@aster-void aster-void changed the title 非同期処理の追加 (新セクション作成後移動してマージ) 非同期処理の追加 (新セクション作成後移動) Dec 21, 2023
@aster-void aster-void marked this pull request as draft April 11, 2024 13:49
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