All files / Consumer MiddlewareFacade.js

80% Statements 12/15
100% Branches 0/0
0% Functions 0/3
80% Lines 12/15

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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x               2x 2x   2x 2x 2x 2x 2x 2x 2x 2x   2x                              
import Middleware  from './Middleware';
 
/**
 * A facade between the `Middleware` instance and consumer, ensuring that
 * only the necessary methods and properties are exposed to the consumer.
 */
 
class MiddlewareFacade {
    constructor(wrapper, options) {
        const middleware = new Middleware(wrapper, options);
 
        this.configure = middleware.configure.bind(middleware);
        this.loadAsset = middleware.loadAsset.bind(middleware);
        this.fadeInVolume = middleware.fadeInVolume.bind(middleware);
        this.fadeOutVolume = middleware.fadeOutVolume.bind(middleware);
        this.showControls = middleware.showControls.bind(middleware);
        this.hideControls = middleware.hideControls.bind(middleware);
        this.destroy = middleware.destroy.bind(middleware);
        this.exitFullscreen = middleware.exitFullscreen.bind(middleware);
 
        Object.defineProperties(this, {
            state: {
                get: () => middleware.state,
            },
            legacyShim$: {
                get: () => middleware.legacyShim$,
            },
            playerInteractions$: {
                get: () => middleware.playerInteractions$,
            },
        });
    }
}
 
export default MiddlewareFacade;