Security update for Core, with self-updated composer
[yaffs-website] / node_modules / phridge / lib / disposeAll.js
1 "use strict";
2
3 var instances = require("./instances.js");
4
5 /**
6  * Terminates all running PhantomJS processes. Returns a Promises/A+ compliant promise
7  * which resolves when a processes terminated cleanly.
8  *
9  * @returns {Promise}
10  */
11 function disposeAll() {
12     var copy = instances.slice(0); // copy the array because phantom.dispose() will modify it
13
14     return Promise.all(copy.map(exit));
15 }
16
17 /**
18  * @private
19  * @param {Phantom} phantom
20  * @returns {Promise}
21  */
22 function exit(phantom) {
23     return phantom.dispose();
24 }
25
26 module.exports = disposeAll;