Skip to content

Commit a1f56e8

Browse files
authored
Applying my own suggestions (haha)
1 parent 4cbd745 commit a1f56e8

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

README.md

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ import worker from 'workerize-loader?inline!./worker'
7070
Type: `String`
7171
Default: `[hash]`
7272

73-
You can pass filename prefix for the compiled worker. Note, that `.worker` suffix will be added automatically
73+
Customize filename generation for worker bundles. Note that a `.worker` suffix will be injected automatically (`{name}.worker.js`).
7474

7575
```js
7676
// webpack.config.js
@@ -89,7 +89,7 @@ import worker from 'workerize-loader?{"name":"[name].[contenthash:8]"}!./worker'
8989
Type: `String`
9090
Default: based on `output.publicPath`
9191

92-
You can pass `publicPath` to specify the public URL address of the output files
92+
Workerize uses the configured value of `output.publicPath` from Webpack unless specified here. The value of `publicPath` gets prepended to bundle filenames to get their full URL. It can be a path, or a full URL with host.
9393

9494
```js
9595
// webpack.config.js
@@ -108,7 +108,7 @@ import worker from 'workerize-loader?{"publicPath":"/static/"}!./worker'
108108
Type: `Boolean`
109109
Default: `false`
110110

111-
You can pass `ready` to set up a wrapper around the `"ready"` event
111+
If `true`, the imported "workerized" module will include a `ready` property, which is a Promise that resolves once the Worker has been loaded. Note: this is unnecessary in most cases, since worker methods can be called prior to the worker being loaded.
112112

113113
```js
114114
// webpack.config.js
@@ -126,31 +126,12 @@ let instance = worker() // `new` is optional
126126
await instance.ready
127127
```
128128

129-
#### `fallback`
130-
131-
Type: `Boolean`
132-
Default: `true`
133-
134-
// TODO: document fallback option
135-
136-
```js
137-
// webpack.config.js
138-
{
139-
loader: 'workerize-loader',
140-
options: { fallback: false }
141-
}
142-
```
143-
or
144-
```js
145-
import worker from 'workerize-loader?fallback=false!./worker'
146-
```
147-
148129
#### `import`
149130

150131
Type: `Boolean`
151132
Default: `false`
152133

153-
// TODO: document import option
134+
When enabled, generated output will create your Workers using a Data URL that loads your code via `importScripts` (eg: `new Worker('data:,importScripts("url")')`). This workaround enables cross-origin script preloading, but Workers are created on an "opaque origin" and cannot access resources on the origin of their host page without CORS enabled. Only enable it if you understand this and specifically need the workaround.
154135

155136
```js
156137
// webpack.config.js

0 commit comments

Comments
 (0)