ঘোষণা :
15 এপ্রিল, 2025 এর আগে আর্থ ইঞ্জিন ব্যবহার করার জন্য নিবন্ধিত সমস্ত অবাণিজ্যিক প্রকল্পগুলিকে অবশ্যই আর্থ ইঞ্জিন অ্যাক্সেস বজায় রাখার জন্য
অ-বাণিজ্যিক যোগ্যতা যাচাই করতে হবে।
ui.util.rateLimit
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি ফাংশনকে র্যাপ করে এটিকে প্রতি ব্যবধানে সর্বাধিক একবার কল করার অনুমতি দেয়। যদি র্যাপার ফাংশনটি একাধিকবার কল করা হয়, তবে শুধুমাত্র প্রথম কলটি হবে, এবং ব্যবধান অতিবাহিত না হওয়া পর্যন্ত পরবর্তী কোনো আহ্বানের প্রভাব থাকবে না। এটি এমন একটি ফাংশন নিশ্চিত করতে ব্যবহার করা যেতে পারে যা অবিলম্বে কার্যকর চালানোর জন্য ব্যয়বহুল কিন্তু বারবার চালানো হয় না।
উদাহরণ ব্যবহার: একটি ui.Button-এ ক্লিক করার জন্য কলব্যাক করার জন্য, যাতে বোতামটি ভুলবশত ডাবল-ক্লিক হওয়া থেকে বিরত থাকে এবং কলব্যাকটি দুবার চালু না হয়।
হার-সীমিত ফাংশন প্রদান করে।
ব্যবহার | রিটার্নস | ui.util.rateLimit(func, delay, scope ) | ফাংশন |
যুক্তি | টাইপ | বিস্তারিত | func | ফাংশন | কল করার ফাংশন। |
delay | সংখ্যা | ফাংশনটি কল করার পরে এবং কার্যকর করার পরে, ফাংশনের একটি অতিরিক্ত আহ্বানের অনুমতি দেওয়ার আগে বিলম্ব করতে মিলিসেকেন্ডের সংখ্যা। |
scope | বস্তু, ঐচ্ছিক | অবজেক্ট যার সুযোগে ফাংশন কল করতে হবে। |
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-24 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. |"]]