Herf onclick=atom.commands.dispatch(atom.views.getView(atom.workspace), "name:command");

I’m working on a a package and wanted to add anchors that run functions from a panel but I can’t get the herf

onclick=atom.commands.dispatch(atom.views.getView(atom.workspace), “myproject:testFunction”);

to call the function. I have tried with the function inside the myproject and myproject-view

const testa = document.createElement('a');
testa.innerText = 'test';
testa.onclick = onclick=atom.commands.dispatch(atom.views.getView(atom.workspace), "myproject:testFunction"); 
this.element.appendChild(testa);

myfunction(){console.log(’‘Test Message’);}

I got it to work and call the function. I forgot to add it to the subscriptions