bare-stow-target-react-native 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/index.js +10 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -32,12 +32,16 @@ import stow from 'bare-stow/host'
32
32
  import bundle from ${JSON.stringify(bundleSpecifier)}
33
33
 
34
34
  export default {
35
- async start(opts = {}) {
35
+ async start({ timeout, grace, ...opts } = {}) {
36
36
  const worklet = new Worklet(opts)
37
37
 
38
38
  worklet.start('/core.bundle', bundle)
39
39
 
40
- const ${ipc} = stow.wrap(worklet.IPC)
40
+ const ${ipc} = stow.wrap(worklet.IPC, { kill: () => worklet.terminate(), timeout, grace })
41
+
42
+ // The worklet outlives its runtime until terminated, so release it once the
43
+ // runtime has reported its exit.
44
+ ${ipc}.on('exit', () => worklet.terminate())
41
45
  ${client ? '\n' + indent(client.source, 4) : ''}
42
46
  await ${ipc}.ready
43
47
 
@@ -50,7 +54,10 @@ ${client ? '\n' + indent(client.source, 4) : ''}
50
54
  extension: '.d.ts',
51
55
  source: `\
52
56
  declare const harness: {
53
- start(opts?: import('react-native-bare-kit').WorkletOptions): Promise<${handle}>
57
+ start(
58
+ opts?: import('react-native-bare-kit').WorkletOptions &
59
+ Omit<import('bare-stow/host').IPCOptions, 'kill'>
60
+ ): Promise<${handle}>
54
61
  }
55
62
 
56
63
  export default harness
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-stow-target-react-native",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React Native target for bare-stow",
5
5
  "exports": {
6
6
  "./package": "./package.json",