Многопоточность
С помощью Web Workers, есть возможность запускать JavaScript в потоках на уровне операционной системы.
Многопоточный Node.js
It is possible to use Node.js features in Electron's Web Workers, to do so the nodeIntegrationInWorker
option should be set to true
in webPreferences
.
const win = new BrowserWindow({
webPreferences: {
nodeIntegrationInWorker: true
}
})
The nodeIntegrationInWorker
can be used independent of nodeIntegration
, but sandbox
must not be set to true
.
Note: This option is not available in SharedWorker
s or Service Worker
s owing to incompatibilities in sandboxing policies.