-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
5144 rename throttle component changed #5151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
393b3c6
228193b
90fb8c0
7b2844a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,14 +68,21 @@ module.exports.throttle = function (functionToThrottle, minimumInterval, optiona | |
| * Returns throttle function that gets called at most once every interval. | ||
| * If there are multiple calls in the last interval we call the function one additional | ||
| * time. | ||
| * It behaves like a throttle except for the very last call that gets deferred until the end of the interval. | ||
| * It behaves like throttle except for the very last call that gets deferred until the end of the interval. | ||
| * This is useful when an event is used to trigger synchronization of state, and there is a need to converge | ||
| * to the correct final state following a burst of events. | ||
| * | ||
| * Example use cases: | ||
| * - synchronizing state based on the componentchanged event | ||
| * - following a mouse pointer using the mousemove event | ||
| * - integrating with THREE.TransformControls, via the objectChange event. | ||
| * | ||
| * @param {function} functionToThrottle | ||
| * @param {number} minimumInterval - Minimal interval between calls (milliseconds). | ||
| * @param {object} optionalContext - If given, bind function to throttle to this context. | ||
| * @returns {function} Throttled function. | ||
| */ | ||
| module.exports.throttleComponentChanged = function (functionToThrottle, minimumInterval, optionalContext) { | ||
| module.exports.throttleLeadingAndTrailing = function (functionToThrottle, minimumInterval, optionalContext) { | ||
| var lastTime; | ||
| var deferTimer; | ||
| if (optionalContext) { | ||
|
|
@@ -99,6 +106,12 @@ module.exports.throttleComponentChanged = function (functionToThrottle, minimumI | |
| }; | ||
| }; | ||
|
|
||
| /** | ||
| * Identical to throttleLeadingAndTrailing. | ||
| * Exists for back-compatibility with 1.3.0. | ||
| */ | ||
| module.exports.throttleComponentChanged = module.exports.throttleLeadingAndTrailing; | ||
|
||
|
|
||
| /** | ||
| * Returns throttle function that gets called at most once every interval. | ||
| * Uses the time/timeDelta timestamps provided by the global render loop for better perf. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if this reference is a liability long term in case lodash API changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, but the existing docs already reference loadash throttle (the same link)
See: https://aframe.io/docs/1.3.0/core/utils.html#aframe-utils-throttle-function-minimuminterval-optionalcontext
This doesn't make the situation any worse, I think.