Skip to content

Debouncing Animate function to avoid frequent invocations#589

Open
suresh-gangumalla wants to merge 5 commits intolightning-js:devfrom
suresh-gangumalla:feat/debounce-animate-function
Open

Debouncing Animate function to avoid frequent invocations#589
suresh-gangumalla wants to merge 5 commits intolightning-js:devfrom
suresh-gangumalla:feat/debounce-animate-function

Conversation

@suresh-gangumalla
Copy link
Collaborator

@suresh-gangumalla suresh-gangumalla commented Jan 30, 2026

changes to any property in transition object like delay, duration, vaule, ease are subject to invocation of animate function. when morethan single property get updated then transition subjected to creation of multiple animation objects which are neccessary so added debounce with configurable timeout so that it can reduce number of animation function invocations.

user can configure animateDebounceDelay in settings to alter delay timeout in ms, the default value is 50ms

changes to any property transition object like delay, duration,
vaule, ease are subject to invocation of animate function. when morethan
single property get updated then transition subjected to creation of
multiple animation objects which are neccessary so added debounce with
configurable timeout so that it can reduce number of animation function
invocations.

user can configure animateDebounceDelay  in settings to alter delay
timeout in ms, the default value is 50ms

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link

Test Results: ❌ FAILED

Run at: 2026-01-30T09:25:11.282Z

Summary:
Test execution encountered errors. No tests were run.

Error Output:


> @lightningjs/blits@1.47.0 test:ci
> c8 npm run test:run


> @lightningjs/blits@1.47.0 test:run
> node -r global-jsdom/register ./node_modules/.bin/tape '{,!(node_modules|packages)/**/}*.test.js' | tap-diff

(node:2244) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/esm/resolve:854
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@lightningjs/renderer' imported from /home/runner/work/blits/blits/src/engines/L3/launch.js
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.16.0

passed: 0  failed: 0  of 0 tests  (622ms)

All of 0 tests passed!

---------------------|---------|----------|---------|---------|-------------------------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                   
---------------------|---------|----------|---------|---------|-------------------------------------
All files            |   47.53 |       75 |   11.11 |   47.53 |                                     
 src                 |      80 |    66.66 |      50 |      80 |                                     
  settings.js        |      80 |    66.66 |      50 |      80 | 24,30-36                            
 src/announcer       |   28.69 |       60 |       4 |   28.69 |                                     
  announcer.js       |   35.93 |       50 |    5.55 |   35.93 | ...,170-174,177-195,198-214,217-218 
  speechSynthesis.js |   21.81 |      100 |       0 |   21.81 | ...,100-135,138-207,211-219,222-237 
 src/lib             |      80 |      100 |   22.22 |      80 |                                     
  log.js             |   59.82 |      100 |   22.22 |   59.82 | 29-31,46-55,61-70,76-85,91-104      
  symbols.js         |     100 |      100 |     100 |     100 |                                     
---------------------|---------|----------|---------|---------|-------------------------------------

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link

Test Results: ❌ FAILED

Run at: 2026-01-30T09:35:34.735Z

Summary:
Test execution encountered errors. No tests were run.

Error Output:


> @lightningjs/blits@1.47.0 test:ci
> c8 npm run test:run


> @lightningjs/blits@1.47.0 test:run
> node -r global-jsdom/register ./node_modules/.bin/tape '{,!(node_modules|packages)/**/}*.test.js' | tap-diff

(node:2268) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/esm/resolve:854
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@lightningjs/renderer' imported from /home/runner/work/blits/blits/src/engines/L3/launch.js
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v20.16.0

passed: 0  failed: 0  of 0 tests  (620ms)

All of 0 tests passed!

---------------------|---------|----------|---------|---------|-------------------------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                   
---------------------|---------|----------|---------|---------|-------------------------------------
All files            |   47.53 |       75 |   11.11 |   47.53 |                                     
 src                 |      80 |    66.66 |      50 |      80 |                                     
  settings.js        |      80 |    66.66 |      50 |      80 | 24,30-36                            
 src/announcer       |   28.69 |       60 |       4 |   28.69 |                                     
  announcer.js       |   35.93 |       50 |    5.55 |   35.93 | ...,170-174,177-195,198-214,217-218 
  speechSynthesis.js |   21.81 |      100 |       0 |   21.81 | ...,100-135,138-207,211-219,222-237 
 src/lib             |      80 |      100 |   22.22 |      80 |                                     
  log.js             |   59.82 |      100 |   22.22 |   59.82 | 29-31,46-55,61-70,76-85,91-104      
  symbols.js         |     100 |      100 |     100 |     100 |                                     
---------------------|---------|----------|---------|---------|-------------------------------------

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link

Test Results: ✅ PASSED

Run at: 2026-01-30T09:38:56.119Z

Summary:
passed: 1002 failed: 0 of 1002 tests

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link

Test Results: ✅ PASSED

Run at: 2026-01-30T10:36:31.905Z

Summary:
passed: 1002 failed: 0 of 1002 tests

Comment on lines 231 to 235
/**
* Debounce delay for animate function (initialized on first use).
* @type {number|null}
*/
let animateDebounceDelay = null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need this I think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as we are always going with 0 ms timeout we don't need this. Removed in latest commit.

Signed-off-by: Suresh Kumar Gangumalla <sureshkumar.gangumalla@invecas.com>
@github-actions
Copy link

github-actions bot commented Feb 2, 2026

Test Results: ✅ PASSED

Run at: 2026-02-02T05:29:07.623Z

Summary:
passed: 1002 failed: 0 of 1002 tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants