You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'm trying to setup comlink in a typescript project but can't work out why this doesn't work.
My calling method/ class
import Mehs from "@/myTest.worker";
export default class TestCalling{``
public async callMyTestMethod(): Promise {
const meh: Mehs = new Mehs();``
const ss: string = await meh.greet("Neil");
console.log(ss);
}
}`
My test class/method
export default class TestWorker{
public async greet(subject: string): Promise {
return new Promise((resolve) => {
resolve(Hello, ${subject}!);
});
}
}
This give me the following error : "TypeError: meh.greet is not a function"
However if i just export a function it works i.e.
export async function greet(subject: string): Promise {
return new Promise((resolve) => {
resolve(Hello, ${subject}!);
});
}
But i want to use a class as it may have multiple functions that i want to call. What am i doing wrong ?
The text was updated successfully, but these errors were encountered:
'm trying to setup comlink in a typescript project but can't work out why this doesn't work.
My calling method/ class
import Mehs from "@/myTest.worker";
export default class TestCalling{``
public async callMyTestMethod(): Promise {
const meh: Mehs = new Mehs();``
const ss: string = await meh.greet("Neil");
console.log(ss);
}
}`
My test class/method
export default class TestWorker{
public async greet(subject: string): Promise {
return new Promise((resolve) => {
resolve(
Hello, ${subject}!
);});
}
}
This give me the following error : "TypeError: meh.greet is not a function"
However if i just export a function it works i.e.
export async function greet(subject: string): Promise {
return new Promise((resolve) => {
resolve(
Hello, ${subject}!
);});
}
But i want to use a class as it may have multiple functions that i want to call. What am i doing wrong ?
The text was updated successfully, but these errors were encountered: