stopPolling
stopPolling
Info
stopPolling stops the periodic polling timer started by startPolling and clears the registered callbacks. The native capture process continues running — only the JavaScript-side polling is stopped.
Signature
function stopPolling(): voidParameters
This function takes no parameters.
Usage
Call stopPolling when you want to stop receiving periodic analysis updates but keep the native capture process running. This is uncommon — in most cases, calling stop is preferred since it stops both polling and the capture process.
Note
Calling stopPolling when no polling is active is a safe no-op.
Tips
If you want to temporarily pause updates (e.g. when the UI is hidden), call stopPolling and later call startPolling again. The capture process continues in the background, so new data is available immediately when polling resumes.
Return Value
This function returns void.
Warning
After stopPolling, the onUpdate and onError callbacks are cleared. You must call startPolling again with new callbacks to resume receiving updates.
Example
import { start, startPolling, stopPolling, stop } from '@eisland/windows-volume-analyzer';
start(12345);
// Start polling
startPolling(16, (result) => {
console.log(`RMS: ${result.amplitude.rms.toFixed(3)}`);
});
// Pause polling (capture continues in background)
stopPolling();
console.log('Polling paused');
// Resume polling with the same or different interval
startPolling(33, (result) => {
console.log(`RMS: ${result.amplitude.rms.toFixed(3)}`);
});
// Clean up everything
stop();const { start, startPolling, stopPolling, stop } = require('@eisland/windows-volume-analyzer');
start(12345);
// Start polling
startPolling(16, (result) => {
console.log(`RMS: ${result.amplitude.rms.toFixed(3)}`);
});
// Pause polling (capture continues in background)
stopPolling();
console.log('Polling paused');
// Resume polling with the same or different interval
startPolling(33, (result) => {
console.log(`RMS: ${result.amplitude.rms.toFixed(3)}`);
});
// Clean up everything
stop();Notes
Note
stopPolling does not call stop. The native capture process continues running and producing analysis data. To fully terminate the analysis session, call stop instead.
Tips
For most use cases, skip stopPolling and call stop directly. stop automatically calls stopPolling internally, so there is no risk of leaving the timer running.
Important
After stopPolling, you can still call getResult to read the latest result manually. The data continues to be updated by the capture process — only the automatic callback delivery is stopped.
Danger Avoidance
Caution
Do not call stopPolling and assume the capture process has also stopped. The native capture process continues consuming CPU and memory. Always call stop to fully release resources when analysis is no longer needed.
Changelog
bb5b2-on

