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
Is there any place I can find an example of writing a web worker in typescript? I have created a new file myworker.ts that looks like below:
/// <reference path="IWorkerMessages.ts" />self.onmessage=(ev: MessageEvent)=>{vardata=<IWorkerIncoming>ev.data;}// I get a compiler error while trying to define self.deserializeself.deserialize=(data: IWorkerIncoming)=>{}
Thanks for the link. Actually I found it more confusing than helpful to be honest. I am not using any virtual projects. Further I am developing a single page app with no MVC. I do my compilation within VS and am not using command line. The problems I am struggling with are:
How to compile the web worker code into a separate js
Looking at examples of web workers, it seems the compiled js ought to look something like:
self.onmessage = function()...
but if I write a typescript file that implements the Worker interface, that is not the compiled js I will get.
I posted here as I thought response would be faster (and it was, thanks :)
Is there any place I can find an example of writing a web worker in typescript? I have created a new file myworker.ts that looks like below:
could the file be refactored to something like
Edited by @DanielRosenwasser to add code fences.
The text was updated successfully, but these errors were encountered: