mirror of
https://github.com/S2-/gitlit
synced 2025-08-03 21:00:04 +02:00
packager
This commit is contained in:
25
app/node_modules/electron-packager/hooks.js
generated
vendored
Normal file
25
app/node_modules/electron-packager/hooks.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict'
|
||||
|
||||
const pify = require('pify')
|
||||
|
||||
module.exports = {
|
||||
promisifyHooks: function promisifyHooks (hooks, args) {
|
||||
if (!hooks || !Array.isArray(hooks)) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
return Promise.all(hooks.map(hookFn => pify(hookFn).apply(this, args)))
|
||||
},
|
||||
serialHooks: function serialHooks (hooks) {
|
||||
return function () {
|
||||
const args = Array.prototype.splice.call(arguments, 0, arguments.length - 1)
|
||||
const done = arguments[arguments.length - 1]
|
||||
let result = Promise.resolve()
|
||||
for (const hook of hooks) {
|
||||
result = result.then(() => hook.apply(this, args))
|
||||
}
|
||||
|
||||
return result.then(() => done()) // eslint-disable-line promise/no-callback-in-promise
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user