@colisweb/rescript-toolkit 4.14.4 → 4.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colisweb/rescript-toolkit",
3
- "version": "4.14.4",
3
+ "version": "4.14.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -1,7 +1,7 @@
1
1
  let localStorageKey = "@colisweb/mock"
2
2
 
3
3
  @react.component
4
- let make = (~worker: Msw.worker, ~children) => {
4
+ let make = (~worker: Msw.worker, ~workerOptions: Msw.startOptions={}, ~children) => {
5
5
  let (mockEnabled, setMock) = Toolkit__Hooks.useLocalStorageState(
6
6
  localStorageKey,
7
7
  {
@@ -12,7 +12,7 @@ let make = (~worker: Msw.worker, ~children) => {
12
12
 
13
13
  React.useLayoutEffect1(() => {
14
14
  if mockEnabled {
15
- worker->Msw.start
15
+ worker->Msw.start(workerOptions)
16
16
  setWorkerStarted(_ => true)
17
17
  Browser.LocalStorage.setItem(localStorageKey, Js.Nullable.return("true"))
18
18
  } else {
@@ -4,8 +4,11 @@ type worker
4
4
  @module("msw") @variadic
5
5
  external setupWorker: array<mock> => worker = "setupWorker"
6
6
 
7
+ type rec startOptions = {serviceWorker?: serviceWorker}
8
+ and serviceWorker = {url: string}
9
+
7
10
  @send
8
- external start: worker => unit = "start"
11
+ external start: (worker, startOptions) => unit = "start"
9
12
  @send
10
13
  external stop: worker => unit = "stop"
11
14