Add default message handler to WorkerPar
lars-t-hansen opened this issue · 0 comments
lars-t-hansen commented
At the moment this idiom is used everywhere:
var Par = new WorkerPar();
onmessage =
function (ev) {
if (!Par.dispatch(ev.data))
postMessage("Unknown: " + ev.data);
};
It would be reasonable to support this idiom to allow simply this:
onmessage = (new WorkerPar()).defaultMessageHandler;
Even if theWorkerPar
instance is needed (eg for Par.self
) and has to be captured this is an improvement.