Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ember/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A build chain for WebWorkers in Ember applications with intuitive ergonomics.
## Usage

To use a worker in your application or addon, you first have to define
a new worker in a top-level `workers/` directory in your project.
a new worker in a top-level `workers/` directory in the root your project (as opposed to `app/`).

> **Example 1**
>
Expand Down
7 changes: 7 additions & 0 deletions packages/ember/addon-test-support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { getContext } from '@ember/test-helpers';

export function getWorker(name) {
Copy link
Contributor Author

@NullVoxPopuli NullVoxPopuli May 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this'd be TS'

getWorker<K extends keyof WorkerRegistry>(name: K): WorkerRegistry[K] {

}

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't set up ts support for the ember portions of this project just yet, but yeah that would be something nice :)

let { owner } = getContext();

return owner.lookup('service:-workers').getWorker(name);
}