All files / src/node-groups DebugProtectionNodesGroup.ts

71.43% Statements 10/14
25% Branches 1/4
100% Functions 1/1
71.43% Lines 10/14
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 36 37 38 39 40 41 42 43    1x 1x 1x   1x 1x   1x       14x           14x   14x 14x                                        
import { IOptions } from "../interfaces/IOptions";
 
import { DebugProtectionFunctionCallNode } from "../custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode";
import { DebugProtectionFunctionIntervalNode } from "../custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode";
import { DebugProtectionFunctionNode } from "../custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode";
 
import { NodesGroup } from './NodesGroup';
import { Utils } from '../Utils';
 
export class DebugProtectionNodesGroup extends NodesGroup {
    /**
     * @type {string}
     */
    private debugProtectionFunctionIdentifier: string = Utils.getRandomVariableName();
 
    /**
     * @param options
     */
    constructor (options: IOptions) {
        super(options);
 
        Eif (!this.options.debugProtection) {
            return;
        }
 
        this.nodes.set(
            'debugProtectionFunctionNode',
            new DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier, this.options)
        );
        this.nodes.set(
            'debugProtectionFunctionCallNode',
            new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier, this.options)
        );
 
        if (this.options.debugProtectionInterval) {
            this.nodes.set(
                'debugProtectionFunctionIntervalNode',
                new DebugProtectionFunctionIntervalNode(this.debugProtectionFunctionIdentifier, this.options)
            );
        }
    }
}