I am making a chrome extension that aims to pause execution of a tab if it inactive after some time in order to stop if from consuming resources.
By "Pause", I mean something like debugger, however, debugger does not seem to work unless the developer inspector tool is open.
Is there anyway to stop a tab from consuming resources until the user goes to that tab and click on something (like the play button on debugger)
PS: I want to make this because there a synonym/dictionary website that slowly consumes 5GB of RAM even if it is left inactive for half an hour.
CodePudding user response:
The only way is using alert() or prompt(). Enter may be used to confirm and continue executing.
CodePudding user response:
Chrome extension has API for this. Tab discard
chrome.tabs.discard(
tabId?: number,
callback?: function,
)
Add permission tabs if required.
