공지사항:
2025년 4월 15일 전에 Earth Engine 사용을 위해 등록된 모든 비상업용 프로젝트는 Earth Engine 액세스를 유지하기 위해
비상업용 자격 요건을 인증해야 합니다.
ui.util.rateLimit
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
함수를 래핑하여 간격당 최대 한 번 호출되도록 합니다. 래퍼 함수가 두 번 이상 호출되면 첫 번째 호출만 실행되고 간격이 경과할 때까지 후속 호출은 적용되지 않습니다. 이를 사용하면 실행하는 데 비용이 많이 드는 함수가 즉시 실행되지만 반복적으로 실행되지 않도록 할 수 있습니다.
사용 예: 버튼이 실수로 두 번 클릭되어 콜백이 두 번 실행되는 것을 방지하기 위해 ui.Button 클릭에 대한 콜백에 사용됩니다.
속도 제한 함수를 반환합니다.
사용 | 반환 값 |
---|
ui.util.rateLimit(func, delay, scope) | 함수 |
인수 | 유형 | 세부정보 |
---|
func | 함수 | 호출할 함수입니다. |
delay | 숫자 | 함수가 호출되고 실행된 후 함수의 추가 호출을 허용하기 전에 지연할 밀리초 수입니다. |
scope | 객체, 선택사항 | 함수를 호출할 범위의 객체입니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[null,null,["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eLimits a function's execution to at most once per specified interval, preventing rapid, repeated calls.\u003c/p\u003e\n"],["\u003cp\u003eUseful for optimizing expensive functions or preventing unintended double-click actions, such as on UI buttons.\u003c/p\u003e\n"],["\u003cp\u003eReturns a rate-limited version of the original function, accepting the function, delay, and optional scope as parameters.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes a delay mechanism to ensure subsequent calls are ignored until the interval has elapsed, guaranteeing controlled execution.\u003c/p\u003e\n"]]],[],null,["# ui.util.rateLimit\n\n\u003cbr /\u003e\n\nWraps a function to allow it to be called, at most, once per interval. If the wrapper function is called more than once, only the first call will go through, and no subsequent invocations will have an effect until the interval has elapsed. This can be used to ensure a function that is expensive to run executes immediately but doesn't execute repeatedly.\n\n\u003cbr /\u003e\n\nExample use: For the callback to a click on a ui.Button, in order to prevent the button from being accidentally double-clicked and the callback running twice.\n\nReturns the rate-limited function.\n\n| Usage | Returns |\n|---------------------------------------------|----------|\n| `ui.util.rateLimit(func, delay, `*scope*`)` | Function |\n\n| Argument | Type | Details |\n|----------|------------------|------------------------------------------------------------------------------------------------------------------------------------------|\n| `func` | Function | Function to call. |\n| `delay` | Number | After the function is called and executed, the number of milliseconds to delay before allowing an additional invocation of the function. |\n| `scope` | Object, optional | Object in whose scope to call the function. |"]]