1 | 'use strict';
|
2 |
|
3 | const Launcher = require('./launcher');
|
4 | const extend = require('lodash.assignin');
|
5 |
|
6 | function getUniqueId() {
|
7 | return process.hrtime().join('');
|
8 | }
|
9 |
|
10 | module.exports = class LauncherFactory {
|
11 | constructor(name, settings, config) {
|
12 | this.name = name;
|
13 | this.config = config;
|
14 | this.settings = settings;
|
15 | }
|
16 |
|
17 | create(options) {
|
18 | const id = getUniqueId();
|
19 | const settings = extend({ id }, this.settings, options);
|
20 | return new Launcher(this.name, settings, this.config);
|
21 | }
|
22 | };
|