Type alias HookFunction

HookFunction: ((options) => void | Promise<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.

Type declaration

    • (options): void | Promise<void>
    • Parameters

      Returns void | Promise<void>

Example

import { packager, serialHooks } from '@electron/packager'

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.