{"library":"metal-debounce","title":"Metal Debounce Utility","description":"metal-debounce is a utility library providing a debounce function, originally part of the deprecated Metal.js framework. It delays the execution of a function until a specified time has elapsed since its last invocation, a common pattern for optimizing event handlers (e.g., input, resize, scroll) by preventing excessive calls. The current stable version is 2.0.2, last published approximately seven years ago. As the Metal.js framework itself is no longer actively maintained for open-source releases, this package should be considered abandoned. It likely targets older JavaScript environments and CommonJS modules, lacking modern features like native ESM support or TypeScript definitions. Alternatives like `lodash.debounce` or `debounce-fn` offer more robust and actively maintained solutions.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install metal-debounce"],"cli":null},"imports":["const debounce = require('metal-debounce');","const debounce = require('metal-debounce');\nconst debouncedFunction = debounce(() => console.log('Action!'), 200);"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const debounce = require('metal-debounce');\n\nfunction logActivity(message) {\n  console.log(`Activity: ${message} at ${new Date().toLocaleTimeString()}`);\n}\n\n// Create a debounced version of logActivity that waits 500ms\nconst debouncedLog = debounce(logActivity, 500);\n\nconsole.log('Simulating rapid events...');\ndebouncedLog('Event 1');\ndebouncedLog('Event 2');\ndebouncedLog('Event 3');\n\nsetTimeout(() => {\n  console.log('Waiting 600ms after last debounced call...');\n  debouncedLog('Event 4 (should trigger)');\n}, 600);\n\nsetTimeout(() => {\n  console.log('Simulating more rapid events after initial trigger...');\n  debouncedLog('Event 5');\n  debouncedLog('Event 6');\n}, 1200);\n\nsetTimeout(() => {\n  console.log('Final wait...');\n}, 2000);","lang":"javascript","description":"Demonstrates basic usage of the `debounce` function to limit repeated calls, such as from rapid user input.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}