DebugProtectionFunctionNode.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { injectable, inject } from 'inversify';
  2. import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
  3. import * as format from 'string-template';
  4. import { IOptions } from '../../interfaces/options/IOptions';
  5. import { initializable } from '../../decorators/Initializable';
  6. import { DebugProtectionFunctionTemplate } from '../../templates/custom-nodes/debug-protection-nodes/debug-protection-function-node/DebugProtectionFunctionTemplate';
  7. import { AbstractCustomNode } from '../AbstractCustomNode';
  8. @injectable()
  9. export class DebugProtectionFunctionNode extends AbstractCustomNode {
  10. /**
  11. * @type {string}
  12. */
  13. @initializable()
  14. private debugProtectionFunctionName: string;
  15. /**
  16. * @param options
  17. */
  18. constructor (
  19. @inject(ServiceIdentifiers.IOptions) options: IOptions
  20. ) {
  21. super(options);
  22. }
  23. /**
  24. * @param debugProtectionFunctionName
  25. */
  26. public initialize (debugProtectionFunctionName: string): void {
  27. this.debugProtectionFunctionName = debugProtectionFunctionName;
  28. }
  29. /**
  30. * @returns {string}
  31. */
  32. public getCode (): string {
  33. return format(DebugProtectionFunctionTemplate(), {
  34. debugProtectionFunctionName: this.debugProtectionFunctionName
  35. });
  36. }
  37. }