UNPKG

504 BJavaScriptView Raw
1'use strict';
2
3const Launcher = require('./launcher');
4const extend = require('lodash.assignin');
5
6function getUniqueId() {
7 return process.hrtime().join('');
8}
9
10module.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};