Let's say I'm using Vue 3 and Websockets (for context) and I have this wrapped inside a <script setup> tag.
function hello() {
console.log("world")
}
const mapper = () => {
// self.hello is not a function
self['hello']();
}
mapper();
How do I execute a function using only strings because I plan on adding more and need mapper to map them to functions outside of onmessage.
I am using TypeScript 4.4 and get:
Uncaught TypeError: self.hello is not a function