Chrome extension – clear clipboard after timeout

I’m writing a little password manager as a chrome extension.
Now I want to clear the clipboard after some seconds to make it a little more secure.

    function copy(){

    document.addEventListener('copy', function(e){
        e.clipboardData.setData('text/plain', password);
        }, 2000);

I think it doesn’t work, because there is no direct user interaction triggering the clear clipboard event, but how can i do it?

(I’ve seen this chrome clipboard api, but it’s written everywhere that you shouldn’t use it)

Copy string to clipboard, without using a DOM element?

I have this code that works:

let textarea = document.createElement('textarea');
textarea.setAttribute('type', 'hidden');
textarea.textContent = 'the string you want to copy';

as you can see – I have the string to copy in hand. But I have to create a temporary hidden DOM element to score the string before copying to the clipboard.

My question is, is there some API to copy to clipboard without needing the DOM at all? something like this:

document.execCommand('copy', 'the string data to put in clipboard');

seems weird that the DOM is necessary to do this. Also, as a side note, this clipboard API is super strange, anyone else agree?