1

My worker-api.ts file is:

   export class WorkerApi {

        private worker:Worker;

        constructor() {
            this.worker = new Worker("layout-worker.js");
        }
        // more ...
    }

And I am trying to create the in javascript as follows:

require(["../common/events.js", "worker-api.js"], function (events, worker) {
// worker is null so worker.WorkerApi() won't work either.
var api = new WorkerApi();

I also tried with internal modules so it was named MyModule.WorkerApi() - that also failed (we are using external modules for our .ts files).

What am I missing? I'm guessing I need to set something in the .ts file so the requires passes an object in function (events, worker) but can't find what it is.

thanks - dave

2
  • 1
    Have you tried looking at worker-api.js? Commented Apr 17, 2014 at 23:01
  • @SpiderPig Oh yes. When I did an internal module it created a global var MyModule - but that still was not available in the .js file. Commented Apr 17, 2014 at 23:18

1 Answer 1

2

Remove the .js file extension I.e.

require(["../common/events", "./worker-api"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.