File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -46,20 +46,17 @@ JavaScriptは非同期なので、`setTimeout`と`setInterval`関数を使って
46
46
47
47
` foo ` がコードをブロックしている間、` setInterval ` は呼び出される予定を確保しています。` foo ` が完了した瞬間に、実行を待っている間に** 10回** 以上呼び出されている事になります。
48
48
49
- ### Dealing with Possible Blocking Code
49
+ ### ブロッキング可能なコードの取り扱い
50
50
51
- The easiest as well as most controllable solution, is to use ` setTimeout ` within
52
- the function itself.
51
+ 簡単かつ、一番コントロール可能な解決法として、関数自体の中で` setTimeout ` を使うという方法があります。
53
52
54
53
function foo(){
55
- // something that blocks for 1 second
54
+ // 1秒ブロックする何か
56
55
setTimeout(foo, 100);
57
56
}
58
57
foo();
59
58
60
- Not only does this encapsulate the ` setTimeout ` call, but it also prevents the
61
- stacking of calls and it gives additional control.` foo ` itself can now decide
62
- whether it wants to run again or not.
59
+ このカプセル化は` setTimeout ` の呼び出しだけでなく、呼び出しのスタッキングを防止してより詳細なコントロールが出来ます。` foo ` それ自身が今や、再度実行するかしないかを決める事が出来るのです。
63
60
64
61
### Manually Clearing Timeouts
65
62
You can’t perform that action at this time.
0 commit comments