Skip to content

Propose renaming throttleComponentChanged to throttledDebounce #5144

@diarmidmackenzie

Description

@diarmidmackenzie

Description:

  • A-Frame Version: 1.3.0
  • Platform / Device: All
  • Reproducible Code Snippet or URL: N/A

Since 1.3.0, we have a new utility function:

AFRAME.utils.throttleComponentChanged

This was introduced by PR #4980 to solve #4972

This truns out to be a generically useful utility function, but it doesn't have a generic name.

Recently in an A-Frame app I wanted to do exactly the same thing with the objectChange event from THREE.TransformControls.

But using a utility function called throttleComponentChanged to do a debounced throttle on an event called objectChange could have been confusing...!

I propose renaming this utility function to a name that reflects it's generic capability, namely to debounce an event in a throttled manner, which puts a cap on the rate at which the event fires, but also guarantees a correct end state.

My suggested name is AFRAME.utils.throttledDebounce

I'd be happy to do the PR to do all of this, assuming I can get agreement this is a good idea.

I expect we need to keep AFRAME.utils.throttleComponentChanged for back compatibility, but it can just be mapped to AFRAME.utils.throttledDebounce.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions