Type alias HookFunction

HookFunction: ((buildPath, electronVersion, platform, arch, callback) => void)

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 by serialHooks. For example:

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 HookFunctions, see the list of related plugins.

Type declaration