Skip to content

Commit 9bab686

Browse files
committed
translate "setTimeout and setInterval" in "Others" to ja
1 parent 2013516 commit 9bab686

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

doc/ja/other/timeouts.md

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,35 @@
1-
### `setTimeout` and `setInterval`
1+
### `setTimeout``setInterval`
22

3-
Since JavaScript is asynchronous, it is possible to schedule the execution of a
4-
function by using the `setTimeout` and `setInterval` functions.
3+
JavaScriptは非同期なので、`setTimeout``setInterval`関数を使ってある関数の実行のスケジュールを決める事が可能です。
54

6-
> **Note:** Timeouts are **not** part of the ECMAScript Standard. They are
7-
> implemented as part of the [DOM][1].
5+
> **注意点:** タイムアウトはECMAScript標準の一部では**ありません**
6+
> これらは[DOM][1]の一部として実装されています。
87
98
function foo() {}
10-
var id = setTimeout(foo, 1000); // returns a Number > 0
9+
var id = setTimeout(foo, 1000); // Number > 0を返す
1110

12-
When `setTimeout` gets called, it will return the ID of the timeout and schedule
13-
`foo` to run in **approximately** one thousand milliseconds in the future.
14-
`foo` will then get executed exactly **once**.
11+
`setTimeout`が呼ばれた時に、タイムアウトのIDと`foo`この先の**おおよそ**1000msに実行するスケジュールを返します。`foo`は正確に**1度**だけ実行されます。
1512

16-
Depending on the timer resolution of the JavaScript engine that is running the
17-
code, as well as the fact that JavaScript is single threaded and other code that
18-
gets executed might block the thread, it is by **no means** a safe bet that one
19-
will get the exact delay that was specified in the `setTimeout` call.
13+
コードが実行されているJavaScriptエンジンのタイマー分解能によって決まります。この事実はJavaScriptがシングルスレッドのなので、他のスレッドでの実行を妨害してしまう事があるかもしれません。これは、`setTimeout`の呼び出しにより指定された正確なディレイで実行するという確実な賭けという**意味ではありません**
2014

21-
The function that was passed as the first parameter will get called by the
22-
*global object*, that means, that [`this`](#function.this) inside the called function
23-
refers to that very object.
15+
第一パラメーターを渡された関数は*グローバルオブジェクト*によって呼び出されます。これは呼び出された関数の内部で[`this`](#functionis)がまさにこのオブジェクトを参照しているという事になります。
2416

2517
function Foo() {
2618
this.value = 42;
2719
this.method = function() {
28-
// this refers to the global object
29-
console.log(this.value); // will log undefined
20+
// これはグローバルオブジェクトを参照しています
21+
console.log(this.value); // undefinedを記録するはずです
3022
};
3123
setTimeout(this.method, 500);
3224
}
3325
new Foo();
3426

3527

36-
> **Note:** As `setTimeout` takes a **function object** as its first parameter, an
37-
> often made mistake is to use `setTimeout(foo(), 1000)`, which will use the
38-
> **return value** of the call `foo` and **not** `foo`. This is, most of the time,
39-
> a silent error, since when the function returns `undefined` `setTimeout` will
40-
> **not** raise any error.
28+
> **注意点:** `setTimeout`**関数オブジェクト**を第一引数に取ります。
29+
> 良く間違えてしまう使い方として`setTimeout(foo(), 1000)`というものがあります。
30+
> `foo``foo`**以外**の呼び出しに対する**戻り値**としてしまいます。これは、大体において、
31+
> 関数が`undefined`になる為に表に出ないエラーになるでしょう。`setTimeout`はどんな
32+
> エラーも発生`させません`
4133
4234
### Stacking Calls with `setInterval`
4335

0 commit comments

Comments
 (0)