fix: use factory method to create worker executor
This commit is contained in:
@ -16,7 +16,7 @@ import presetReact from '@babel/preset-react';
|
||||
import protect from 'loop-protect';
|
||||
|
||||
import * as vinyl from '../utils/polyvinyl.js';
|
||||
import WorkerExecutor from '../utils/worker-executor';
|
||||
import createWorker from '../utils/worker-executor';
|
||||
|
||||
const protectTimeout = 100;
|
||||
Babel.registerPlugin('loopProtection', protect(protectTimeout));
|
||||
@ -91,7 +91,7 @@ export const babelTransformer = cond([
|
||||
[stubTrue, identity]
|
||||
]);
|
||||
|
||||
const sassWorker = new WorkerExecutor('sass-compile');
|
||||
const sassWorker = createWorker('sass-compile');
|
||||
async function transformSASS(element) {
|
||||
const styleTags = element.querySelectorAll('style[type="text/sass"]');
|
||||
await Promise.all(
|
||||
|
@ -27,14 +27,14 @@ import {
|
||||
|
||||
import { challengeTypes } from '../../../../utils/challengeTypes';
|
||||
|
||||
import WorkerExecutor from '../utils/worker-executor';
|
||||
import createWorker from '../utils/worker-executor';
|
||||
import {
|
||||
createMainFramer,
|
||||
createTestFramer,
|
||||
runTestInTestFrame
|
||||
} from '../utils/frame.js';
|
||||
|
||||
const testWorker = new WorkerExecutor('test-evaluator');
|
||||
const testWorker = createWorker('test-evaluator');
|
||||
const testTimeout = 5000;
|
||||
|
||||
function* ExecuteChallengeSaga() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { homeLocation } from '../../../../config/env.json';
|
||||
|
||||
export default class WorkerExecutor {
|
||||
class WorkerExecutor {
|
||||
constructor(workerName) {
|
||||
this.workerName = workerName;
|
||||
this.worker = null;
|
||||
@ -71,3 +71,7 @@ export default class WorkerExecutor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default function createWorkerExecutor(workerName) {
|
||||
return new WorkerExecutor(workerName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user