All files / src index.ts

100% Statements 17/17
57.45% Branches 27/47
47.06% Functions 8/17
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 2x 3x 3x 3x 3x  
import merge from 'lodash/merge';
import { IllusionEngine } from './illusion-engine';
import { Options, defaultOptions } from './options';
import { Servicer } from './servicer/servicer';
 
const offscreenCanvasSupported = !!window.OffscreenCanvas;
 
export async function installIllusionEngine(options?: Options): Promise<IllusionEngine> {
    options = merge({}, defaultOptions, options);
    options.useWorker = offscreenCanvasSupported && options.useWorker;
    const importPromise: Promise<new () => Servicer> = options.useWorker ?
        import(/* webpackChunkName: "IllusionWorkerServicer" */ './servicer/worker-servicer').then(({ WorkerServicer }) => WorkerServicer):
        import(/* webpackChunkName: "IllusionNornalServicer" */ './servicer/normal-servicer').then(({NormalServicer}) => NormalServicer)
    return importPromise.then(Servicer => {
        return new IllusionEngine(new Servicer(), options!);
    });
}