UNPKG

405 BJavaScriptView Raw
1const { join } = require(`path`)
2const { fork } = require(`child_process`)
3
4module.exports = isTrackingEnabled => async () => {
5 if (!isTrackingEnabled) {
6 return
7 }
8
9 // Submit events on background w/o blocking the main process
10 // nor relying on it's lifecycle
11 const forked = fork(join(__dirname, `send.js`), {
12 detached: true,
13 stdio: `ignore`,
14 execArgv: [],
15 })
16 forked.unref()
17}