All files / src/custom-nodes/debug-protection-nodes DebugProtectionFunctionIntervalNode.js

44.44% Statements 4/9
100% Branches 1/1
0% Functions 0/1
44.44% Lines 4/9
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59  1x 1x 1x                                                                                                           1x  
"use strict";
const NodeType_1 = require('../../enums/NodeType');
const Node_1 = require('../Node');
const NodeUtils_1 = require('../../NodeUtils');
class DebugProtectionFunctionIntervalNode extends Node_1.Node {
    constructor(debugProtectionFunctionName, options) {
        super(options);
        this.debugProtectionFunctionName = debugProtectionFunctionName;
        this.node = this.getNodeStructure();
    }
    appendNode(blockScopeNode) {
        NodeUtils_1.NodeUtils.appendNode(blockScopeNode.body, this.getNode());
    }
    getNodeStructure() {
        return {
            'type': NodeType_1.NodeType.ExpressionStatement,
            'expression': {
                'type': NodeType_1.NodeType.CallExpression,
                'callee': {
                    'type': NodeType_1.NodeType.Identifier,
                    'name': 'setInterval'
                },
                'arguments': [
                    {
                        'type': NodeType_1.NodeType.FunctionExpression,
                        'id': null,
                        'params': [],
                        'defaults': [],
                        'body': {
                            'type': NodeType_1.NodeType.BlockStatement,
                            'body': [
                                {
                                    'type': NodeType_1.NodeType.ExpressionStatement,
                                    'expression': {
                                        'type': NodeType_1.NodeType.CallExpression,
                                        'callee': {
                                            'type': NodeType_1.NodeType.Identifier,
                                            'name': this.debugProtectionFunctionName
                                        },
                                        'arguments': []
                                    }
                                }
                            ]
                        },
                        'generator': false,
                        'expression': false
                    },
                    {
                        'type': NodeType_1.NodeType.Literal,
                        'value': 4000,
                        'raw': '4000'
                    }
                ]
            }
        };
    }
}
exports.DebugProtectionFunctionIntervalNode = DebugProtectionFunctionIntervalNode;
//# sourceMappingURL=DebugProtectionFunctionIntervalNode.js.map