File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -31,26 +31,20 @@ JavaScriptは非同期なので、`setTimeout`と`setInterval`関数を使って
31
31
> 関数が` undefined ` になる為に表に出ないエラーになるでしょう。` setTimeout ` はどんな
32
32
> エラーも発生` させません ` 。
33
33
34
- ### Stacking Calls with ` setInterval `
34
+ ### ` setInterval ` でスタッキングコール
35
35
36
- While ` setTimeout ` only runs the function once, ` setInterval ` - as the name
37
- suggests - will execute the function ** every** ` X ` milliseconds. But its use is
38
- discouraged.
36
+ ` setTimeout ` は関数を一度だけ実行します。` setInterval ` - 名前が示すように - ** 毎回** ` X ` ミリ秒毎に関数を実行しますが、この使用は推奨されていません。
39
37
40
- When code that is being executed blocks the timeout call, ` setInterval ` will
41
- still issue more calls to the specified function. This can, especially with small
42
- intervals, result in function calls stacking up.
38
+ コードがタイムアウト呼び出しブロックで実行される時に、` setInterval ` は指定された関数を呼び出します。これは、特に小さい間隔で、関数の結果をスタックに積む事ができます。
43
39
44
40
function foo(){
45
- // something that blocks for 1 second
41
+ // 1秒おきにブロックの何かを実行
46
42
}
47
43
setInterval(foo, 100);
48
44
49
- In the above code ` foo ` will get called once and will then block for one second.
45
+ 上記のコードでは、 ` foo ` が1回呼び出されて、1秒ブロックされます。
50
46
51
- While ` foo ` blocks the code ` setInterval ` will still schedule further calls to
52
- it. Now, when ` foo ` has finished, there will already be ** ten** further calls to
53
- it waiting for execution.
47
+ ` foo ` がコードをブロックしている間、` setInterval ` は呼び出される予定を確保しています。` foo ` が完了した瞬間に、実行を待っている間に** 10回** 以上呼び出されている事になります。
54
48
55
49
### Dealing with Possible Blocking Code
56
50
You can’t perform that action at this time.
0 commit comments