For afterExtract, the path to the temporary folder where the prebuilt Electron binary has been extracted to. For afterCopy and afterPrune, the path to the folder where the Electron app has been copied to. For afterComplete, the final directory of the packaged application.
the version of Electron that is being bundled with the application.
The target platform you are packaging for.
The target architecture you are packaging for.
Must be called once you have completed your actions.
const packager = require('@electron/packager')
const { serialHooks } = require('@electron/packager/src/hooks')
packager({
// ...
afterCopy: [serialHooks([
(buildPath, electronVersion, platform, arch) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
console.log('first function')
resolve()
}, 1000)
})
},
(buildPath, electronVersion, platform, arch) => {
console.log('second function')
}
])],
// ...
})
For real-world examples of HookFunction
s, see the list of related
plugins.
A function that is called on the completion of a packaging stage.
By default, the functions are called in parallel (via
Promise.all
). If you need the functions called serially, there is a utility function provided. Please note that callback-style functions are not supported byserialHooks
.