お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ui.util.throttle
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
関数をラップして、間隔ごとに最大 2 回呼び出せるようにします。遅延が経過する前にラッパー関数が複数回呼び出された場合、最初と最後の呼び出しのみが実行されます。
使用例: ui.Slider のスライド イベントのコールバック。コールバックはすぐに実行されるため、スライド操作がスムーズに感じられます。また、ユーザーがスライダーの操作を終了した後にコールバックが実行されることも保証されているため、最後のコールバック呼び出しでスライダーの最終値にアクセスできます。
ラップされた関数を返します。
用途 | 戻り値 |
---|
ui.util.throttle(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\u003eLimits a function's execution to at most twice per specified interval, ensuring responsiveness and capturing the final state.\u003c/p\u003e\n"],["\u003cp\u003eUseful for scenarios like UI slider events where immediate feedback and final value processing are crucial.\u003c/p\u003e\n"],["\u003cp\u003eWraps the original function and returns a new function that manages the throttling behavior.\u003c/p\u003e\n"],["\u003cp\u003eCustomizable with a delay parameter (in milliseconds) and an optional scope for execution context.\u003c/p\u003e\n"]]],[],null,["# ui.util.throttle\n\n\u003cbr /\u003e\n\nWraps a function to allow it to be called, at most, twice per interval. If the wrapper function is called multiple times before the delay elapses, only the first and the last calls will go through.\n\n\u003cbr /\u003e\n\nExample use: For the callback to a slide event on a ui.Slider. The callback will run immediately, making the slide action feel responsive. The callback is also guaranteed to run after the user has finished interacting with the slider, ensuring that the final callback invocation has access to the slider's final value.\n\nReturns the wrapped function.\n\n| Usage | Returns |\n|--------------------------------------------|----------|\n| `ui.util.throttle(func, delay, `*scope*`)` | Function |\n\n| Argument | Type | Details |\n|----------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `func` | Function | The function to call. |\n| `delay` | Number | The delay, in milliseconds, for the throttle. The function can only be called once after the initial invocation until after the delay has elapsed. |\n| `scope` | Object, optional | The object in whose scope to call the function. |"]]