お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ui.util.debounce
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
関数をラップして、指定された間隔(ミリ秒単位)未満で繰り返し呼び出される一連の呼び出しごとに、最大で 1 回呼び出されるようにします。これは、最終的に実行されることを保証しながら、コストの高い関数の呼び出し回数を減らすために使用できます。
使用例: ui.Checkbox の変更イベントのコールバック。ユーザーがチェックボックスを繰り返しクリックした場合、チェックボックスの最後のクリックでのみコールバックが実行されます。
デバウンスされた関数を返します。
用途 | 戻り値 |
---|
ui.util.debounce(func, delay, scope) | 関数 |
引数 | タイプ | 詳細 |
---|
func | 関数 | デバウンスする関数。 |
delay | 数値 | 関数が 1 回呼び出された後、関数を再度呼び出すまでの遅延時間(ミリ秒単位)。 |
scope | オブジェクト、省略可 | 関数を呼び出すスコープ内のオブジェクト。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003eDebounces a function, limiting its execution to at most once within a specified time interval, even with repeated calls.\u003c/p\u003e\n"],["\u003cp\u003eUseful for optimizing expensive functions triggered by frequent events, ensuring only the last call within the interval is executed.\u003c/p\u003e\n"],["\u003cp\u003eReturns a debounced version of the original function, which can be called directly.\u003c/p\u003e\n"],["\u003cp\u003eCustomizable with parameters like \u003ccode\u003edelay\u003c/code\u003e for setting the debounce interval and \u003ccode\u003escope\u003c/code\u003e for controlling the function's execution context.\u003c/p\u003e\n"]]],[],null,["# ui.util.debounce\n\n\u003cbr /\u003e\n\nWraps a function to allow it to be called, at most, once for each sequence of calls fired repeatedly so long as they are fired less than a specified interval apart (in milliseconds). This can be used to reduce the number of invocations of an expensive function while ensuring it eventually runs.\n\n\u003cbr /\u003e\n\nExample use: For the callback to a change event on a ui.Checkbox. If the user clicks the checkbox repeatedly, only the last click of the checkbox will run the callback.\n\nReturns the debounced function.\n\n| Usage | Returns |\n|--------------------------------------------|----------|\n| `ui.util.debounce(func, delay, `*scope*`)` | Function |\n\n| Argument | Type | Details |\n|----------|------------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| `func` | Function | The function to debounce. |\n| `delay` | Number | After the function is called once, the number of milliseconds to delay for an additional invocation of the function before allowing it to run. |\n| `scope` | Object, optional | Object in whose scope to call the function. |"]]