Skip to content

Calling from a Web Worker #12

@gungorbudak

Description

@gungorbudak

Hi!

I'm using web workers for multi-threaded way of analyzing my data on the browser and I need to do some statistical tests with calls using OpenCPU. However, my first attempts to import it to a web worker didn't work. Since, there is no window or document object in a web worker, I tried to set them to self but jQuery complains about the document object.

// worker.js
var window = self,
    document = self;
importScripts('libs/jquery-1.11.3.js', 'libs/opencpu-0.4.js');
ocpu.seturl("//public.opencpu.org/ocpu/library/base/R");
Uncaught TypeError: Cannot read property 'createElement' of undefined jquery-1.11.3.js:930

Seeing that there are no JS libraries with such tests as in R, I think OpenCPU is the only way to do statistical computation on a browser.

This is actually a jQuery error but I just wanted to bring it to your attention. Any help about calling R code from the worker threads will be appreciated.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions